[graphite] Make GrBlend shareable between Graphite and Ganesh

Additionally make the enums enum-classes.

We will need this to specify fixed function blend modes in Graphite.

This CL is mainly mechanical (i.e., global replace) but some fix-ups were required for our internal bit twiddling with the enum-classes.

Bug: skia:12701
Change-Id: I67abcf8274d14e691974cf253bf65dcb4697bd9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/515318
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2022-03-04 12:28:48 -05:00 committed by SkCQ
parent 5e9388d170
commit 0c43db950c
26 changed files with 856 additions and 824 deletions

View File

@ -47,7 +47,6 @@ skia_gpu_sources = [
"$_src/gpu/GrBackendUtils.cpp", "$_src/gpu/GrBackendUtils.cpp",
"$_src/gpu/GrBackendUtils.h", "$_src/gpu/GrBackendUtils.h",
"$_src/gpu/GrBaseContextPriv.h", "$_src/gpu/GrBaseContextPriv.h",
"$_src/gpu/GrBlend.h",
"$_src/gpu/GrBuffer.h", "$_src/gpu/GrBuffer.h",
"$_src/gpu/GrBufferAllocPool.cpp", "$_src/gpu/GrBufferAllocPool.cpp",
"$_src/gpu/GrBufferAllocPool.h", "$_src/gpu/GrBufferAllocPool.h",
@ -816,6 +815,7 @@ skia_native_gpu_sources = [
skia_shared_gpu_sources = [ skia_shared_gpu_sources = [
"$_include/gpu/ShaderErrorHandler.h", "$_include/gpu/ShaderErrorHandler.h",
"$_include/private/SingleOwner.h", "$_include/private/SingleOwner.h",
"$_src/gpu/Blend.h",
"$_src/gpu/BufferWriter.h", "$_src/gpu/BufferWriter.h",
"$_src/gpu/KeyBuilder.h", "$_src/gpu/KeyBuilder.h",
"$_src/gpu/ResourceKey.cpp", "$_src/gpu/ResourceKey.cpp",

View File

@ -83,7 +83,7 @@ skvm::Color SkModeColorFilter::onProgram(skvm::Builder* p, skvm::Color c,
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if SK_SUPPORT_GPU #if SK_SUPPORT_GPU
#include "src/gpu/GrBlend.h" #include "src/gpu/Blend.h"
#include "src/gpu/GrFragmentProcessor.h" #include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/SkGr.h" #include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrBlendFragmentProcessor.h" #include "src/gpu/effects/GrBlendFragmentProcessor.h"

168
src/gpu/Blend.h Normal file
View File

@ -0,0 +1,168 @@
/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef skgpu_Blend_DEFINED
#define skgpu_Blend_DEFINED
#include "include/core/SkTypes.h"
namespace skgpu {
/**
* Equations for alpha-blending.
*/
enum class BlendEquation {
// Basic blend equations.
kAdd, //<! Cs*S + Cd*D
kSubtract, //<! Cs*S - Cd*D
kReverseSubtract, //<! Cd*D - Cs*S
// Advanced blend equations. These are described in the SVG and PDF specs.
kScreen,
kOverlay,
kDarken,
kLighten,
kColorDodge,
kColorBurn,
kHardLight,
kSoftLight,
kDifference,
kExclusion,
kMultiply,
kHSLHue,
kHSLSaturation,
kHSLColor,
kHSLLuminosity,
kIllegal,
kFirstAdvanced = kScreen,
kLast = kIllegal,
};
static const int kBlendEquationCnt = static_cast<int>(BlendEquation::kLast) + 1;
/**
* Coefficients for alpha-blending.
*/
enum class BlendCoeff {
kZero, //<! 0
kOne, //<! 1
kSC, //<! src color
kISC, //<! one minus src color
kDC, //<! dst color
kIDC, //<! one minus dst color
kSA, //<! src alpha
kISA, //<! one minus src alpha
kDA, //<! dst alpha
kIDA, //<! one minus dst alpha
kConstC, //<! constant color
kIConstC, //<! one minus constant color
kS2C,
kIS2C,
kS2A,
kIS2A,
kIllegal,
kLast = kIllegal,
};
static const int kBlendCoeffCnt = static_cast<int>(BlendCoeff::kLast) + 1;
static constexpr bool BlendCoeffRefsSrc(const BlendCoeff coeff) {
return BlendCoeff::kSC == coeff || BlendCoeff::kISC == coeff || BlendCoeff::kSA == coeff ||
BlendCoeff::kISA == coeff;
}
static constexpr bool BlendCoeffRefsDst(const BlendCoeff coeff) {
return BlendCoeff::kDC == coeff || BlendCoeff::kIDC == coeff || BlendCoeff::kDA == coeff ||
BlendCoeff::kIDA == coeff;
}
static constexpr bool BlendCoeffRefsSrc2(const BlendCoeff coeff) {
return BlendCoeff::kS2C == coeff || BlendCoeff::kIS2C == coeff ||
BlendCoeff::kS2A == coeff || BlendCoeff::kIS2A == coeff;
}
static constexpr bool BlendCoeffsUseSrcColor(BlendCoeff srcCoeff, BlendCoeff dstCoeff) {
return BlendCoeff::kZero != srcCoeff || BlendCoeffRefsSrc(dstCoeff);
}
static constexpr bool BlendCoeffsUseDstColor(BlendCoeff srcCoeff,
BlendCoeff dstCoeff,
bool srcColorIsOpaque) {
return BlendCoeffRefsDst(srcCoeff) ||
(dstCoeff != BlendCoeff::kZero && !(dstCoeff == BlendCoeff::kISA && srcColorIsOpaque));
}
static constexpr bool BlendEquationIsAdvanced(BlendEquation equation) {
return equation >= BlendEquation::kFirstAdvanced &&
equation != BlendEquation::kIllegal;
}
static constexpr bool BlendModifiesDst(BlendEquation equation,
BlendCoeff srcCoeff,
BlendCoeff dstCoeff) {
return (BlendEquation::kAdd != equation && BlendEquation::kReverseSubtract != equation) ||
BlendCoeff::kZero != srcCoeff || BlendCoeff::kOne != dstCoeff;
}
static constexpr bool BlendCoeffRefsConstant(const BlendCoeff coeff) {
return coeff == BlendCoeff::kConstC || coeff == BlendCoeff::kIConstC;
}
static constexpr bool BlendShouldDisable(BlendEquation equation,
BlendCoeff srcCoeff,
BlendCoeff dstCoeff) {
return (BlendEquation::kAdd == equation || BlendEquation::kSubtract == equation) &&
BlendCoeff::kOne == srcCoeff && BlendCoeff::kZero == dstCoeff;
}
/**
* Advanced blend equations can always tweak alpha for coverage. (See GrCustomXfermode.cpp)
*
* For "add" and "reverse subtract" the blend equation with f=coverage is:
*
* D' = f * (S * srcCoeff + D * dstCoeff) + (1-f) * D
* = f * S * srcCoeff + D * (f * dstCoeff + (1 - f))
*
* (Let srcCoeff be negative for reverse subtract.) We can tweak alpha for coverage when the
* following relationship holds:
*
* (f*S) * srcCoeff' + D * dstCoeff' == f * S * srcCoeff + D * (f * dstCoeff + (1 - f))
*
* (Where srcCoeff' and dstCoeff' have any reference to S pre-multiplied by f.)
*
* It's easy to see this works for the src term as long as srcCoeff' == srcCoeff (meaning srcCoeff
* does not reference S). For the dst term, this will work as long as the following is true:
*|
* dstCoeff' == f * dstCoeff + (1 - f)
* dstCoeff' == 1 - f * (1 - dstCoeff)
*
* By inspection we can see this will work as long as dstCoeff has a 1, and any other term in
* dstCoeff references S.
*
* Moreover, if the blend doesn't modify the dst at all then it is ok to arbitrarily modify the src
* color so folding in coverage is allowed.
*/
static constexpr bool BlendAllowsCoverageAsAlpha(BlendEquation equation,
BlendCoeff srcCoeff,
BlendCoeff dstCoeff) {
return BlendEquationIsAdvanced(equation) ||
!BlendModifiesDst(equation, srcCoeff, dstCoeff) ||
((BlendEquation::kAdd == equation || BlendEquation::kReverseSubtract == equation) &&
!BlendCoeffRefsSrc(srcCoeff) &&
(BlendCoeff::kOne == dstCoeff || BlendCoeff::kISC == dstCoeff ||
BlendCoeff::kISA == dstCoeff));
}
} // namespace skgpu
#endif // skgpu_Blend_DEFINED

View File

@ -1,161 +0,0 @@
/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrBlend_DEFINED
#define GrBlend_DEFINED
#include "include/core/SkTypes.h"
/**
* Equations for alpha-blending.
*/
enum GrBlendEquation {
// Basic blend equations.
kAdd_GrBlendEquation, //<! Cs*S + Cd*D
kSubtract_GrBlendEquation, //<! Cs*S - Cd*D
kReverseSubtract_GrBlendEquation, //<! Cd*D - Cs*S
// Advanced blend equations. These are described in the SVG and PDF specs.
kScreen_GrBlendEquation,
kOverlay_GrBlendEquation,
kDarken_GrBlendEquation,
kLighten_GrBlendEquation,
kColorDodge_GrBlendEquation,
kColorBurn_GrBlendEquation,
kHardLight_GrBlendEquation,
kSoftLight_GrBlendEquation,
kDifference_GrBlendEquation,
kExclusion_GrBlendEquation,
kMultiply_GrBlendEquation,
kHSLHue_GrBlendEquation,
kHSLSaturation_GrBlendEquation,
kHSLColor_GrBlendEquation,
kHSLLuminosity_GrBlendEquation,
kIllegal_GrBlendEquation,
kFirstAdvancedGrBlendEquation = kScreen_GrBlendEquation,
kLast_GrBlendEquation = kIllegal_GrBlendEquation,
};
static const int kGrBlendEquationCnt = kLast_GrBlendEquation + 1;
/**
* Coefficients for alpha-blending.
*/
enum GrBlendCoeff {
kZero_GrBlendCoeff, //<! 0
kOne_GrBlendCoeff, //<! 1
kSC_GrBlendCoeff, //<! src color
kISC_GrBlendCoeff, //<! one minus src color
kDC_GrBlendCoeff, //<! dst color
kIDC_GrBlendCoeff, //<! one minus dst color
kSA_GrBlendCoeff, //<! src alpha
kISA_GrBlendCoeff, //<! one minus src alpha
kDA_GrBlendCoeff, //<! dst alpha
kIDA_GrBlendCoeff, //<! one minus dst alpha
kConstC_GrBlendCoeff, //<! constant color
kIConstC_GrBlendCoeff, //<! one minus constant color
kS2C_GrBlendCoeff,
kIS2C_GrBlendCoeff,
kS2A_GrBlendCoeff,
kIS2A_GrBlendCoeff,
kIllegal_GrBlendCoeff,
kLast_GrBlendCoeff = kIllegal_GrBlendCoeff,
};
static const int kGrBlendCoeffCnt = kLast_GrBlendCoeff + 1;
static constexpr bool GrBlendCoeffRefsSrc(const GrBlendCoeff coeff) {
return kSC_GrBlendCoeff == coeff || kISC_GrBlendCoeff == coeff || kSA_GrBlendCoeff == coeff ||
kISA_GrBlendCoeff == coeff;
}
static constexpr bool GrBlendCoeffRefsDst(const GrBlendCoeff coeff) {
return kDC_GrBlendCoeff == coeff || kIDC_GrBlendCoeff == coeff || kDA_GrBlendCoeff == coeff ||
kIDA_GrBlendCoeff == coeff;
}
static constexpr bool GrBlendCoeffRefsSrc2(const GrBlendCoeff coeff) {
return kS2C_GrBlendCoeff == coeff || kIS2C_GrBlendCoeff == coeff ||
kS2A_GrBlendCoeff == coeff || kIS2A_GrBlendCoeff == coeff;
}
static constexpr bool GrBlendCoeffsUseSrcColor(GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff) {
return kZero_GrBlendCoeff != srcCoeff || GrBlendCoeffRefsSrc(dstCoeff);
}
static constexpr bool GrBlendCoeffsUseDstColor(GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff,
bool srcColorIsOpaque) {
return GrBlendCoeffRefsDst(srcCoeff) ||
(dstCoeff != kZero_GrBlendCoeff && !(dstCoeff == kISA_GrBlendCoeff && srcColorIsOpaque));
}
static constexpr bool GrBlendEquationIsAdvanced(GrBlendEquation equation) {
return equation >= kFirstAdvancedGrBlendEquation
&& equation != kIllegal_GrBlendEquation;
}
static constexpr bool GrBlendModifiesDst(GrBlendEquation equation, GrBlendCoeff srcCoeff,
GrBlendCoeff dstCoeff) {
return (kAdd_GrBlendEquation != equation && kReverseSubtract_GrBlendEquation != equation) ||
kZero_GrBlendCoeff != srcCoeff || kOne_GrBlendCoeff != dstCoeff;
}
static constexpr bool GrBlendCoeffRefsConstant(const GrBlendCoeff coeff) {
return coeff == kConstC_GrBlendCoeff || coeff == kIConstC_GrBlendCoeff;
}
static constexpr bool GrBlendShouldDisable(GrBlendEquation equation, GrBlendCoeff srcCoeff,
GrBlendCoeff dstCoeff) {
return (kAdd_GrBlendEquation == equation || kSubtract_GrBlendEquation == equation) &&
kOne_GrBlendCoeff == srcCoeff && kZero_GrBlendCoeff == dstCoeff;
}
/**
* Advanced blend equations can always tweak alpha for coverage. (See GrCustomXfermode.cpp)
*
* For "add" and "reverse subtract" the blend equation with f=coverage is:
*
* D' = f * (S * srcCoeff + D * dstCoeff) + (1-f) * D
* = f * S * srcCoeff + D * (f * dstCoeff + (1 - f))
*
* (Let srcCoeff be negative for reverse subtract.) We can tweak alpha for coverage when the
* following relationship holds:
*
* (f*S) * srcCoeff' + D * dstCoeff' == f * S * srcCoeff + D * (f * dstCoeff + (1 - f))
*
* (Where srcCoeff' and dstCoeff' have any reference to S pre-multiplied by f.)
*
* It's easy to see this works for the src term as long as srcCoeff' == srcCoeff (meaning srcCoeff
* does not reference S). For the dst term, this will work as long as the following is true:
*|
* dstCoeff' == f * dstCoeff + (1 - f)
* dstCoeff' == 1 - f * (1 - dstCoeff)
*
* By inspection we can see this will work as long as dstCoeff has a 1, and any other term in
* dstCoeff references S.
*
* Moreover, if the blend doesn't modify the dst at all then it is ok to arbitrarily modify the src
* color so folding in coverage is allowed.
*/
static constexpr bool GrBlendAllowsCoverageAsAlpha(GrBlendEquation equation,
GrBlendCoeff srcCoeff,
GrBlendCoeff dstCoeff) {
return GrBlendEquationIsAdvanced(equation) ||
!GrBlendModifiesDst(equation, srcCoeff, dstCoeff) ||
((kAdd_GrBlendEquation == equation || kReverseSubtract_GrBlendEquation == equation) &&
!GrBlendCoeffRefsSrc(srcCoeff) &&
(kOne_GrBlendCoeff == dstCoeff || kISC_GrBlendCoeff == dstCoeff ||
kISA_GrBlendCoeff == dstCoeff));
}
#endif

View File

@ -14,7 +14,7 @@
#include "include/gpu/GrDriverBugWorkarounds.h" #include "include/gpu/GrDriverBugWorkarounds.h"
#include "include/private/GrTypesPriv.h" #include "include/private/GrTypesPriv.h"
#include "src/core/SkCompressedDataUtils.h" #include "src/core/SkCompressedDataUtils.h"
#include "src/gpu/GrBlend.h" #include "src/gpu/Blend.h"
#include "src/gpu/GrSamplerState.h" #include "src/gpu/GrSamplerState.h"
#include "src/gpu/GrShaderCaps.h" #include "src/gpu/GrShaderCaps.h"
#include "src/gpu/GrSurfaceProxy.h" #include "src/gpu/GrSurfaceProxy.h"
@ -149,10 +149,10 @@ public:
return kAdvancedCoherent_BlendEquationSupport == fBlendEquationSupport; return kAdvancedCoherent_BlendEquationSupport == fBlendEquationSupport;
} }
bool isAdvancedBlendEquationDisabled(GrBlendEquation equation) const { bool isAdvancedBlendEquationDisabled(skgpu::BlendEquation equation) const {
SkASSERT(GrBlendEquationIsAdvanced(equation)); SkASSERT(skgpu::BlendEquationIsAdvanced(equation));
SkASSERT(this->advancedBlendEquationSupport()); SkASSERT(this->advancedBlendEquationSupport());
return SkToBool(fAdvBlendEqDisableFlags & (1 << equation)); return SkToBool(fAdvBlendEqDisableFlags & (1 << static_cast<int>(equation)));
} }
// On some GPUs it is a performance win to disable blending instead of doing src-over with a src // On some GPUs it is a performance win to disable blending instead of doing src-over with a src
@ -597,7 +597,7 @@ protected:
BlendEquationSupport fBlendEquationSupport; BlendEquationSupport fBlendEquationSupport;
uint32_t fAdvBlendEqDisableFlags; uint32_t fAdvBlendEqDisableFlags;
static_assert(kLast_GrBlendEquation < 32); static_assert(static_cast<int>(skgpu::BlendEquation::kLast) < 32);
uint32_t fMapBufferFlags; uint32_t fMapBufferFlags;
int fBufferMapThreshold; int fBufferMapThreshold;

View File

@ -84,13 +84,13 @@ void GrPipeline::genKey(skgpu::KeyBuilder* b, const GrCaps& caps) const {
static constexpr uint32_t kBlendCoeffSize = 5; static constexpr uint32_t kBlendCoeffSize = 5;
static constexpr uint32_t kBlendEquationSize = 5; static constexpr uint32_t kBlendEquationSize = 5;
static_assert(kLast_GrBlendCoeff < (1 << kBlendCoeffSize)); static_assert(static_cast<int>(skgpu::BlendCoeff::kLast) < (1 << kBlendCoeffSize));
static_assert(kLast_GrBlendEquation < (1 << kBlendEquationSize)); static_assert(static_cast<int>(skgpu::BlendEquation::kLast) < (1 << kBlendEquationSize));
b->addBool(blendInfo.fWriteColor, "writeColor"); b->addBool(blendInfo.fWriteColor, "writeColor");
b->addBits(kBlendCoeffSize, blendInfo.fSrcBlend, "srcBlend"); b->addBits(kBlendCoeffSize, static_cast<int>(blendInfo.fSrcBlend), "srcBlend");
b->addBits(kBlendCoeffSize, blendInfo.fDstBlend, "dstBlend"); b->addBits(kBlendCoeffSize, static_cast<int>(blendInfo.fDstBlend), "dstBlend");
b->addBits(kBlendEquationSize, blendInfo.fEquation, "equation"); b->addBits(kBlendEquationSize, static_cast<int>(blendInfo.fEquation), "equation");
b->addBool(this->usesDstInputAttachment(), "inputAttach"); b->addBool(this->usesDstInputAttachment(), "inputAttach");
} }

View File

@ -55,86 +55,86 @@ void GrXferProcessor::addToKey(const GrShaderCaps& caps,
} }
#ifdef SK_DEBUG #ifdef SK_DEBUG
static const char* equation_string(GrBlendEquation eq) { static const char* equation_string(skgpu::BlendEquation eq) {
switch (eq) { switch (eq) {
case kAdd_GrBlendEquation: case skgpu::BlendEquation::kAdd:
return "add"; return "add";
case kSubtract_GrBlendEquation: case skgpu::BlendEquation::kSubtract:
return "subtract"; return "subtract";
case kReverseSubtract_GrBlendEquation: case skgpu::BlendEquation::kReverseSubtract:
return "reverse_subtract"; return "reverse_subtract";
case kScreen_GrBlendEquation: case skgpu::BlendEquation::kScreen:
return "screen"; return "screen";
case kOverlay_GrBlendEquation: case skgpu::BlendEquation::kOverlay:
return "overlay"; return "overlay";
case kDarken_GrBlendEquation: case skgpu::BlendEquation::kDarken:
return "darken"; return "darken";
case kLighten_GrBlendEquation: case skgpu::BlendEquation::kLighten:
return "lighten"; return "lighten";
case kColorDodge_GrBlendEquation: case skgpu::BlendEquation::kColorDodge:
return "color_dodge"; return "color_dodge";
case kColorBurn_GrBlendEquation: case skgpu::BlendEquation::kColorBurn:
return "color_burn"; return "color_burn";
case kHardLight_GrBlendEquation: case skgpu::BlendEquation::kHardLight:
return "hard_light"; return "hard_light";
case kSoftLight_GrBlendEquation: case skgpu::BlendEquation::kSoftLight:
return "soft_light"; return "soft_light";
case kDifference_GrBlendEquation: case skgpu::BlendEquation::kDifference:
return "difference"; return "difference";
case kExclusion_GrBlendEquation: case skgpu::BlendEquation::kExclusion:
return "exclusion"; return "exclusion";
case kMultiply_GrBlendEquation: case skgpu::BlendEquation::kMultiply:
return "multiply"; return "multiply";
case kHSLHue_GrBlendEquation: case skgpu::BlendEquation::kHSLHue:
return "hsl_hue"; return "hsl_hue";
case kHSLSaturation_GrBlendEquation: case skgpu::BlendEquation::kHSLSaturation:
return "hsl_saturation"; return "hsl_saturation";
case kHSLColor_GrBlendEquation: case skgpu::BlendEquation::kHSLColor:
return "hsl_color"; return "hsl_color";
case kHSLLuminosity_GrBlendEquation: case skgpu::BlendEquation::kHSLLuminosity:
return "hsl_luminosity"; return "hsl_luminosity";
case kIllegal_GrBlendEquation: case skgpu::BlendEquation::kIllegal:
SkASSERT(false); SkASSERT(false);
return "<illegal>"; return "<illegal>";
} }
return ""; return "";
} }
static const char* coeff_string(GrBlendCoeff coeff) { static const char* coeff_string(skgpu::BlendCoeff coeff) {
switch (coeff) { switch (coeff) {
case kZero_GrBlendCoeff: case skgpu::BlendCoeff::kZero:
return "zero"; return "zero";
case kOne_GrBlendCoeff: case skgpu::BlendCoeff::kOne:
return "one"; return "one";
case kSC_GrBlendCoeff: case skgpu::BlendCoeff::kSC:
return "src_color"; return "src_color";
case kISC_GrBlendCoeff: case skgpu::BlendCoeff::kISC:
return "inv_src_color"; return "inv_src_color";
case kDC_GrBlendCoeff: case skgpu::BlendCoeff::kDC:
return "dst_color"; return "dst_color";
case kIDC_GrBlendCoeff: case skgpu::BlendCoeff::kIDC:
return "inv_dst_color"; return "inv_dst_color";
case kSA_GrBlendCoeff: case skgpu::BlendCoeff::kSA:
return "src_alpha"; return "src_alpha";
case kISA_GrBlendCoeff: case skgpu::BlendCoeff::kISA:
return "inv_src_alpha"; return "inv_src_alpha";
case kDA_GrBlendCoeff: case skgpu::BlendCoeff::kDA:
return "dst_alpha"; return "dst_alpha";
case kIDA_GrBlendCoeff: case skgpu::BlendCoeff::kIDA:
return "inv_dst_alpha"; return "inv_dst_alpha";
case kConstC_GrBlendCoeff: case skgpu::BlendCoeff::kConstC:
return "const_color"; return "const_color";
case kIConstC_GrBlendCoeff: case skgpu::BlendCoeff::kIConstC:
return "inv_const_color"; return "inv_const_color";
case kS2C_GrBlendCoeff: case skgpu::BlendCoeff::kS2C:
return "src2_color"; return "src2_color";
case kIS2C_GrBlendCoeff: case skgpu::BlendCoeff::kIS2C:
return "inv_src2_color"; return "inv_src2_color";
case kS2A_GrBlendCoeff: case skgpu::BlendCoeff::kS2A:
return "src2_alpha"; return "src2_alpha";
case kIS2A_GrBlendCoeff: case skgpu::BlendCoeff::kIS2A:
return "inv_src2_alpha"; return "inv_src2_alpha";
case kIllegal_GrBlendCoeff: case skgpu::BlendCoeff::kIllegal:
SkASSERT(false); SkASSERT(false);
return "<illegal>"; return "<illegal>";
} }

View File

@ -9,7 +9,7 @@
#define GrXferProcessor_DEFINED #define GrXferProcessor_DEFINED
#include "include/gpu/GrTypes.h" #include "include/gpu/GrTypes.h"
#include "src/gpu/GrBlend.h" #include "src/gpu/Blend.h"
#include "src/gpu/GrNonAtomicRef.h" #include "src/gpu/GrNonAtomicRef.h"
#include "src/gpu/GrProcessor.h" #include "src/gpu/GrProcessor.h"
#include "src/gpu/GrProcessorAnalysis.h" #include "src/gpu/GrProcessorAnalysis.h"
@ -92,11 +92,11 @@ public:
struct BlendInfo { struct BlendInfo {
SkDEBUGCODE(SkString dump() const;) SkDEBUGCODE(SkString dump() const;)
GrBlendEquation fEquation = kAdd_GrBlendEquation; skgpu::BlendEquation fEquation = skgpu::BlendEquation::kAdd;
GrBlendCoeff fSrcBlend = kOne_GrBlendCoeff; skgpu::BlendCoeff fSrcBlend = skgpu::BlendCoeff::kOne;
GrBlendCoeff fDstBlend = kZero_GrBlendCoeff; skgpu::BlendCoeff fDstBlend = skgpu::BlendCoeff::kZero;
SkPMColor4f fBlendConstant = SK_PMColor4fTRANSPARENT; SkPMColor4f fBlendConstant = SK_PMColor4fTRANSPARENT;
bool fWriteColor = true; bool fWriteColor = true;
}; };
inline BlendInfo getBlendInfo() const { inline BlendInfo getBlendInfo() const {

View File

@ -16,7 +16,7 @@
#include "include/gpu/GrTypes.h" #include "include/gpu/GrTypes.h"
#include "include/private/SkColorData.h" #include "include/private/SkColorData.h"
#include "src/core/SkBlendModePriv.h" #include "src/core/SkBlendModePriv.h"
#include "src/gpu/GrBlend.h" #include "src/gpu/Blend.h"
#include "src/gpu/GrCaps.h" #include "src/gpu/GrCaps.h"
#include "src/gpu/GrColor.h" #include "src/gpu/GrColor.h"
#include "src/gpu/GrSamplerState.h" #include "src/gpu/GrSamplerState.h"
@ -115,16 +115,16 @@ bool SkPaintToGrPaintWithBlend(GrRecordingContext* context,
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Misc Sk to Gr type conversions // Misc Sk to Gr type conversions
static_assert((int)kZero_GrBlendCoeff == (int)SkBlendModeCoeff::kZero); static_assert((int)skgpu::BlendCoeff::kZero == (int)SkBlendModeCoeff::kZero);
static_assert((int)kOne_GrBlendCoeff == (int)SkBlendModeCoeff::kOne); static_assert((int)skgpu::BlendCoeff::kOne == (int)SkBlendModeCoeff::kOne);
static_assert((int)kSC_GrBlendCoeff == (int)SkBlendModeCoeff::kSC); static_assert((int)skgpu::BlendCoeff::kSC == (int)SkBlendModeCoeff::kSC);
static_assert((int)kISC_GrBlendCoeff == (int)SkBlendModeCoeff::kISC); static_assert((int)skgpu::BlendCoeff::kISC == (int)SkBlendModeCoeff::kISC);
static_assert((int)kDC_GrBlendCoeff == (int)SkBlendModeCoeff::kDC); static_assert((int)skgpu::BlendCoeff::kDC == (int)SkBlendModeCoeff::kDC);
static_assert((int)kIDC_GrBlendCoeff == (int)SkBlendModeCoeff::kIDC); static_assert((int)skgpu::BlendCoeff::kIDC == (int)SkBlendModeCoeff::kIDC);
static_assert((int)kSA_GrBlendCoeff == (int)SkBlendModeCoeff::kSA); static_assert((int)skgpu::BlendCoeff::kSA == (int)SkBlendModeCoeff::kSA);
static_assert((int)kISA_GrBlendCoeff == (int)SkBlendModeCoeff::kISA); static_assert((int)skgpu::BlendCoeff::kISA == (int)SkBlendModeCoeff::kISA);
static_assert((int)kDA_GrBlendCoeff == (int)SkBlendModeCoeff::kDA); static_assert((int)skgpu::BlendCoeff::kDA == (int)SkBlendModeCoeff::kDA);
static_assert((int)kIDA_GrBlendCoeff == (int)SkBlendModeCoeff::kIDA); static_assert((int)skgpu::BlendCoeff::kIDA == (int)SkBlendModeCoeff::kIDA);
// static_assert(SkXfermode::kCoeffCount == 10); // static_assert(SkXfermode::kCoeffCount == 10);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -94,10 +94,10 @@ void set_blend_factor(GrD3DGpu* gpu, const GrProgramInfo& info) {
const GrXferProcessor& xferProcessor = info.pipeline().getXferProcessor(); const GrXferProcessor& xferProcessor = info.pipeline().getXferProcessor();
const skgpu::Swizzle& swizzle = info.pipeline().writeSwizzle(); const skgpu::Swizzle& swizzle = info.pipeline().writeSwizzle();
const GrXferProcessor::BlendInfo& blendInfo = xferProcessor.getBlendInfo(); const GrXferProcessor::BlendInfo& blendInfo = xferProcessor.getBlendInfo();
GrBlendCoeff srcCoeff = blendInfo.fSrcBlend; skgpu::BlendCoeff srcCoeff = blendInfo.fSrcBlend;
GrBlendCoeff dstCoeff = blendInfo.fDstBlend; skgpu::BlendCoeff dstCoeff = blendInfo.fDstBlend;
float floatColors[4]; float floatColors[4];
if (GrBlendCoeffRefsConstant(srcCoeff) || GrBlendCoeffRefsConstant(dstCoeff)) { if (skgpu::BlendCoeffRefsConstant(srcCoeff) || skgpu::BlendCoeffRefsConstant(dstCoeff)) {
// Swizzle the blend to match what the shader will output. // Swizzle the blend to match what the shader will output.
SkPMColor4f blendConst = swizzle.applyTo(blendInfo.fBlendConstant); SkPMColor4f blendConst = swizzle.applyTo(blendInfo.fBlendConstant);
floatColors[0] = blendConst.fR; floatColors[0] = blendConst.fR;

View File

@ -267,60 +267,60 @@ static void setup_vertex_input_layout(const GrGeometryProcessor& geomProc,
} }
} }
static D3D12_BLEND blend_coeff_to_d3d_blend(GrBlendCoeff coeff) { static D3D12_BLEND blend_coeff_to_d3d_blend(skgpu::BlendCoeff coeff) {
switch (coeff) { switch (coeff) {
case kZero_GrBlendCoeff: case skgpu::BlendCoeff::kZero:
return D3D12_BLEND_ZERO; return D3D12_BLEND_ZERO;
case kOne_GrBlendCoeff: case skgpu::BlendCoeff::kOne:
return D3D12_BLEND_ONE; return D3D12_BLEND_ONE;
case kSC_GrBlendCoeff: case skgpu::BlendCoeff::kSC:
return D3D12_BLEND_SRC_COLOR; return D3D12_BLEND_SRC_COLOR;
case kISC_GrBlendCoeff: case skgpu::BlendCoeff::kISC:
return D3D12_BLEND_INV_SRC_COLOR; return D3D12_BLEND_INV_SRC_COLOR;
case kDC_GrBlendCoeff: case skgpu::BlendCoeff::kDC:
return D3D12_BLEND_DEST_COLOR; return D3D12_BLEND_DEST_COLOR;
case kIDC_GrBlendCoeff: case skgpu::BlendCoeff::kIDC:
return D3D12_BLEND_INV_DEST_COLOR; return D3D12_BLEND_INV_DEST_COLOR;
case kSA_GrBlendCoeff: case skgpu::BlendCoeff::kSA:
return D3D12_BLEND_SRC_ALPHA; return D3D12_BLEND_SRC_ALPHA;
case kISA_GrBlendCoeff: case skgpu::BlendCoeff::kISA:
return D3D12_BLEND_INV_SRC_ALPHA; return D3D12_BLEND_INV_SRC_ALPHA;
case kDA_GrBlendCoeff: case skgpu::BlendCoeff::kDA:
return D3D12_BLEND_DEST_ALPHA; return D3D12_BLEND_DEST_ALPHA;
case kIDA_GrBlendCoeff: case skgpu::BlendCoeff::kIDA:
return D3D12_BLEND_INV_DEST_ALPHA; return D3D12_BLEND_INV_DEST_ALPHA;
case kConstC_GrBlendCoeff: case skgpu::BlendCoeff::kConstC:
return D3D12_BLEND_BLEND_FACTOR; return D3D12_BLEND_BLEND_FACTOR;
case kIConstC_GrBlendCoeff: case skgpu::BlendCoeff::kIConstC:
return D3D12_BLEND_INV_BLEND_FACTOR; return D3D12_BLEND_INV_BLEND_FACTOR;
case kS2C_GrBlendCoeff: case skgpu::BlendCoeff::kS2C:
return D3D12_BLEND_SRC1_COLOR; return D3D12_BLEND_SRC1_COLOR;
case kIS2C_GrBlendCoeff: case skgpu::BlendCoeff::kIS2C:
return D3D12_BLEND_INV_SRC1_COLOR; return D3D12_BLEND_INV_SRC1_COLOR;
case kS2A_GrBlendCoeff: case skgpu::BlendCoeff::kS2A:
return D3D12_BLEND_SRC1_ALPHA; return D3D12_BLEND_SRC1_ALPHA;
case kIS2A_GrBlendCoeff: case skgpu::BlendCoeff::kIS2A:
return D3D12_BLEND_INV_SRC1_ALPHA; return D3D12_BLEND_INV_SRC1_ALPHA;
case kIllegal_GrBlendCoeff: case skgpu::BlendCoeff::kIllegal:
return D3D12_BLEND_ZERO; return D3D12_BLEND_ZERO;
} }
SkUNREACHABLE; SkUNREACHABLE;
} }
static D3D12_BLEND blend_coeff_to_d3d_blend_for_alpha(GrBlendCoeff coeff) { static D3D12_BLEND blend_coeff_to_d3d_blend_for_alpha(skgpu::BlendCoeff coeff) {
switch (coeff) { switch (coeff) {
// Force all srcColor used in alpha slot to alpha version. // Force all srcColor used in alpha slot to alpha version.
case kSC_GrBlendCoeff: case skgpu::BlendCoeff::kSC:
return D3D12_BLEND_SRC_ALPHA; return D3D12_BLEND_SRC_ALPHA;
case kISC_GrBlendCoeff: case skgpu::BlendCoeff::kISC:
return D3D12_BLEND_INV_SRC_ALPHA; return D3D12_BLEND_INV_SRC_ALPHA;
case kDC_GrBlendCoeff: case skgpu::BlendCoeff::kDC:
return D3D12_BLEND_DEST_ALPHA; return D3D12_BLEND_DEST_ALPHA;
case kIDC_GrBlendCoeff: case skgpu::BlendCoeff::kIDC:
return D3D12_BLEND_INV_DEST_ALPHA; return D3D12_BLEND_INV_DEST_ALPHA;
case kS2C_GrBlendCoeff: case skgpu::BlendCoeff::kS2C:
return D3D12_BLEND_SRC1_ALPHA; return D3D12_BLEND_SRC1_ALPHA;
case kIS2C_GrBlendCoeff: case skgpu::BlendCoeff::kIS2C:
return D3D12_BLEND_INV_SRC1_ALPHA; return D3D12_BLEND_INV_SRC1_ALPHA;
default: default:
@ -329,13 +329,13 @@ static D3D12_BLEND blend_coeff_to_d3d_blend_for_alpha(GrBlendCoeff coeff) {
} }
static D3D12_BLEND_OP blend_equation_to_d3d_op(GrBlendEquation equation) { static D3D12_BLEND_OP blend_equation_to_d3d_op(skgpu::BlendEquation equation) {
switch (equation) { switch (equation) {
case kAdd_GrBlendEquation: case skgpu::BlendEquation::kAdd:
return D3D12_BLEND_OP_ADD; return D3D12_BLEND_OP_ADD;
case kSubtract_GrBlendEquation: case skgpu::BlendEquation::kSubtract:
return D3D12_BLEND_OP_SUBTRACT; return D3D12_BLEND_OP_SUBTRACT;
case kReverseSubtract_GrBlendEquation: case skgpu::BlendEquation::kReverseSubtract:
return D3D12_BLEND_OP_REV_SUBTRACT; return D3D12_BLEND_OP_REV_SUBTRACT;
default: default:
SkUNREACHABLE; SkUNREACHABLE;
@ -348,10 +348,10 @@ static void fill_in_blend_state(const GrPipeline& pipeline, D3D12_BLEND_DESC* bl
const GrXferProcessor::BlendInfo& blendInfo = pipeline.getXferProcessor().getBlendInfo(); const GrXferProcessor::BlendInfo& blendInfo = pipeline.getXferProcessor().getBlendInfo();
GrBlendEquation equation = blendInfo.fEquation; skgpu::BlendEquation equation = blendInfo.fEquation;
GrBlendCoeff srcCoeff = blendInfo.fSrcBlend; skgpu::BlendCoeff srcCoeff = blendInfo.fSrcBlend;
GrBlendCoeff dstCoeff = blendInfo.fDstBlend; skgpu::BlendCoeff dstCoeff = blendInfo.fDstBlend;
bool blendOff = GrBlendShouldDisable(equation, srcCoeff, dstCoeff); bool blendOff = skgpu::BlendShouldDisable(equation, srcCoeff, dstCoeff);
auto& rtBlend = blendDesc->RenderTarget[0]; auto& rtBlend = blendDesc->RenderTarget[0];
rtBlend.BlendEnable = !blendOff; rtBlend.BlendEnable = !blendOff;
@ -704,4 +704,3 @@ sk_sp<GrD3DPipeline> GrD3DPipelineStateBuilder::MakeComputePipeline(GrD3DGpu* gp
return GrD3DPipeline::Make(std::move(pipelineState)); return GrD3DPipeline::Make(std::move(pipelineState));
} }

View File

@ -156,13 +156,13 @@ static uint32_t get_blend_info_key(const GrPipeline& pipeline) {
static const uint32_t kBlendWriteShift = 1; static const uint32_t kBlendWriteShift = 1;
static const uint32_t kBlendCoeffShift = 5; static const uint32_t kBlendCoeffShift = 5;
static_assert(kLast_GrBlendCoeff < (1 << kBlendCoeffShift)); static_assert((int)skgpu::BlendCoeff::kLast < (1 << kBlendCoeffShift));
static_assert(kFirstAdvancedGrBlendEquation - 1 < 4); static_assert((int)skgpu::BlendEquation::kFirstAdvanced - 1 < 4);
uint32_t key = blendInfo.fWriteColor; uint32_t key = blendInfo.fWriteColor;
key |= (blendInfo.fSrcBlend << kBlendWriteShift); key |= ((int)blendInfo.fSrcBlend << kBlendWriteShift);
key |= (blendInfo.fDstBlend << (kBlendWriteShift + kBlendCoeffShift)); key |= ((int)blendInfo.fDstBlend << (kBlendWriteShift + kBlendCoeffShift));
key |= (blendInfo.fEquation << (kBlendWriteShift + 2 * kBlendCoeffShift)); key |= ((int)blendInfo.fEquation << (kBlendWriteShift + 2 * kBlendCoeffShift));
return key; return key;
} }

View File

@ -15,65 +15,65 @@
#include "src/gpu/effects/GrTextureEffect.h" #include "src/gpu/effects/GrTextureEffect.h"
#include "src/utils/SkShaderUtils.h" #include "src/utils/SkShaderUtils.h"
static wgpu::BlendFactor to_dawn_blend_factor(GrBlendCoeff coeff) { static wgpu::BlendFactor to_dawn_blend_factor(skgpu::BlendCoeff coeff) {
switch (coeff) { switch (coeff) {
case kZero_GrBlendCoeff: case skgpu::BlendCoeff::kZero:
return wgpu::BlendFactor::Zero; return wgpu::BlendFactor::Zero;
case kOne_GrBlendCoeff: case skgpu::BlendCoeff::kOne:
return wgpu::BlendFactor::One; return wgpu::BlendFactor::One;
case kSC_GrBlendCoeff: case skgpu::BlendCoeff::kSC:
return wgpu::BlendFactor::Src; return wgpu::BlendFactor::Src;
case kISC_GrBlendCoeff: case skgpu::BlendCoeff::kISC:
return wgpu::BlendFactor::OneMinusSrc; return wgpu::BlendFactor::OneMinusSrc;
case kDC_GrBlendCoeff: case skgpu::BlendCoeff::kDC:
return wgpu::BlendFactor::Dst; return wgpu::BlendFactor::Dst;
case kIDC_GrBlendCoeff: case skgpu::BlendCoeff::kIDC:
return wgpu::BlendFactor::OneMinusDst; return wgpu::BlendFactor::OneMinusDst;
case kSA_GrBlendCoeff: case skgpu::BlendCoeff::kSA:
return wgpu::BlendFactor::SrcAlpha; return wgpu::BlendFactor::SrcAlpha;
case kISA_GrBlendCoeff: case skgpu::BlendCoeff::kISA:
return wgpu::BlendFactor::OneMinusSrcAlpha; return wgpu::BlendFactor::OneMinusSrcAlpha;
case kDA_GrBlendCoeff: case skgpu::BlendCoeff::kDA:
return wgpu::BlendFactor::DstAlpha; return wgpu::BlendFactor::DstAlpha;
case kIDA_GrBlendCoeff: case skgpu::BlendCoeff::kIDA:
return wgpu::BlendFactor::OneMinusDstAlpha; return wgpu::BlendFactor::OneMinusDstAlpha;
case kConstC_GrBlendCoeff: case skgpu::BlendCoeff::kConstC:
return wgpu::BlendFactor::Constant; return wgpu::BlendFactor::Constant;
case kIConstC_GrBlendCoeff: case skgpu::BlendCoeff::kIConstC:
return wgpu::BlendFactor::OneMinusConstant; return wgpu::BlendFactor::OneMinusConstant;
case kS2C_GrBlendCoeff: case skgpu::BlendCoeff::kS2C:
case kIS2C_GrBlendCoeff: case skgpu::BlendCoeff::kIS2C:
case kS2A_GrBlendCoeff: case skgpu::BlendCoeff::kS2A:
case kIS2A_GrBlendCoeff: case skgpu::BlendCoeff::kIS2A:
default: default:
SkASSERT(!"unsupported blend coefficient"); SkASSERT(!"unsupported blend coefficient");
return wgpu::BlendFactor::One; return wgpu::BlendFactor::One;
} }
} }
static wgpu::BlendFactor to_dawn_blend_factor_for_alpha(GrBlendCoeff coeff) { static wgpu::BlendFactor to_dawn_blend_factor_for_alpha(skgpu::BlendCoeff coeff) {
switch (coeff) { switch (coeff) {
// Force all srcColor used in alpha slot to alpha version. // Force all srcColor used in alpha slot to alpha version.
case kSC_GrBlendCoeff: case skgpu::BlendCoeff::kSC:
return wgpu::BlendFactor::SrcAlpha; return wgpu::BlendFactor::SrcAlpha;
case kISC_GrBlendCoeff: case skgpu::BlendCoeff::kISC:
return wgpu::BlendFactor::OneMinusSrcAlpha; return wgpu::BlendFactor::OneMinusSrcAlpha;
case kDC_GrBlendCoeff: case skgpu::BlendCoeff::kDC:
return wgpu::BlendFactor::DstAlpha; return wgpu::BlendFactor::DstAlpha;
case kIDC_GrBlendCoeff: case skgpu::BlendCoeff::kIDC:
return wgpu::BlendFactor::OneMinusDstAlpha; return wgpu::BlendFactor::OneMinusDstAlpha;
default: default:
return to_dawn_blend_factor(coeff); return to_dawn_blend_factor(coeff);
} }
} }
static wgpu::BlendOperation to_dawn_blend_operation(GrBlendEquation equation) { static wgpu::BlendOperation to_dawn_blend_operation(skgpu::BlendEquation equation) {
switch (equation) { switch (equation) {
case kAdd_GrBlendEquation: case skgpu::BlendEquation::kAdd:
return wgpu::BlendOperation::Add; return wgpu::BlendOperation::Add;
case kSubtract_GrBlendEquation: case skgpu::BlendEquation::kSubtract:
return wgpu::BlendOperation::Subtract; return wgpu::BlendOperation::Subtract;
case kReverseSubtract_GrBlendEquation: case skgpu::BlendEquation::kReverseSubtract:
return wgpu::BlendOperation::ReverseSubtract; return wgpu::BlendOperation::ReverseSubtract;
default: default:
SkASSERT(!"unsupported blend equation"); SkASSERT(!"unsupported blend equation");
@ -175,9 +175,9 @@ static wgpu::VertexFormat to_dawn_vertex_format(GrVertexAttribType type) {
static wgpu::BlendState create_blend_state(const GrDawnGpu* gpu, const GrPipeline& pipeline) { static wgpu::BlendState create_blend_state(const GrDawnGpu* gpu, const GrPipeline& pipeline) {
GrXferProcessor::BlendInfo blendInfo = pipeline.getXferProcessor().getBlendInfo(); GrXferProcessor::BlendInfo blendInfo = pipeline.getXferProcessor().getBlendInfo();
GrBlendEquation equation = blendInfo.fEquation; skgpu::BlendEquation equation = blendInfo.fEquation;
GrBlendCoeff srcCoeff = blendInfo.fSrcBlend; skgpu::BlendCoeff srcCoeff = blendInfo.fSrcBlend;
GrBlendCoeff dstCoeff = blendInfo.fDstBlend; skgpu::BlendCoeff dstCoeff = blendInfo.fDstBlend;
wgpu::BlendFactor srcFactor = to_dawn_blend_factor(srcCoeff); wgpu::BlendFactor srcFactor = to_dawn_blend_factor(srcCoeff);
wgpu::BlendFactor dstFactor = to_dawn_blend_factor(dstCoeff); wgpu::BlendFactor dstFactor = to_dawn_blend_factor(dstCoeff);

View File

@ -67,28 +67,28 @@ std::unique_ptr<GrXferProcessor::ProgramImpl> CoverageSetOpXP::makeProgramImpl()
void CoverageSetOpXP::onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const { void CoverageSetOpXP::onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const {
switch (fRegionOp) { switch (fRegionOp) {
case SkRegion::kReplace_Op: case SkRegion::kReplace_Op:
blendInfo->fSrcBlend = kOne_GrBlendCoeff; blendInfo->fSrcBlend = skgpu::BlendCoeff::kOne;
blendInfo->fDstBlend = kZero_GrBlendCoeff; blendInfo->fDstBlend = skgpu::BlendCoeff::kZero;
break; break;
case SkRegion::kIntersect_Op: case SkRegion::kIntersect_Op:
blendInfo->fSrcBlend = kDC_GrBlendCoeff; blendInfo->fSrcBlend = skgpu::BlendCoeff::kDC;
blendInfo->fDstBlend = kZero_GrBlendCoeff; blendInfo->fDstBlend = skgpu::BlendCoeff::kZero;
break; break;
case SkRegion::kUnion_Op: case SkRegion::kUnion_Op:
blendInfo->fSrcBlend = kOne_GrBlendCoeff; blendInfo->fSrcBlend = skgpu::BlendCoeff::kOne;
blendInfo->fDstBlend = kISC_GrBlendCoeff; blendInfo->fDstBlend = skgpu::BlendCoeff::kISC;
break; break;
case SkRegion::kXOR_Op: case SkRegion::kXOR_Op:
blendInfo->fSrcBlend = kIDC_GrBlendCoeff; blendInfo->fSrcBlend = skgpu::BlendCoeff::kIDC;
blendInfo->fDstBlend = kISC_GrBlendCoeff; blendInfo->fDstBlend = skgpu::BlendCoeff::kISC;
break; break;
case SkRegion::kDifference_Op: case SkRegion::kDifference_Op:
blendInfo->fSrcBlend = kZero_GrBlendCoeff; blendInfo->fSrcBlend = skgpu::BlendCoeff::kZero;
blendInfo->fDstBlend = kISC_GrBlendCoeff; blendInfo->fDstBlend = skgpu::BlendCoeff::kISC;
break; break;
case SkRegion::kReverseDifference_Op: case SkRegion::kReverseDifference_Op:
blendInfo->fSrcBlend = kIDC_GrBlendCoeff; blendInfo->fSrcBlend = skgpu::BlendCoeff::kIDC;
blendInfo->fDstBlend = kZero_GrBlendCoeff; blendInfo->fDstBlend = skgpu::BlendCoeff::kZero;
break; break;
} }
blendInfo->fBlendConstant = SK_PMColor4fTRANSPARENT; blendInfo->fBlendConstant = SK_PMColor4fTRANSPARENT;

View File

@ -28,31 +28,31 @@ bool GrCustomXfermode::IsSupportedMode(SkBlendMode mode) {
// Static helpers // Static helpers
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
static constexpr GrBlendEquation hw_blend_equation(SkBlendMode mode) { static constexpr skgpu::BlendEquation hw_blend_equation(SkBlendMode mode) {
constexpr int kEqOffset = (kOverlay_GrBlendEquation - (int)SkBlendMode::kOverlay); constexpr int kEqOffset = ((int)skgpu::BlendEquation::kOverlay - (int)SkBlendMode::kOverlay);
static_assert(kOverlay_GrBlendEquation == (int)SkBlendMode::kOverlay + kEqOffset); static_assert((int)skgpu::BlendEquation::kOverlay == (int)SkBlendMode::kOverlay + kEqOffset);
static_assert(kDarken_GrBlendEquation == (int)SkBlendMode::kDarken + kEqOffset); static_assert((int)skgpu::BlendEquation::kDarken == (int)SkBlendMode::kDarken + kEqOffset);
static_assert(kLighten_GrBlendEquation == (int)SkBlendMode::kLighten + kEqOffset); static_assert((int)skgpu::BlendEquation::kLighten == (int)SkBlendMode::kLighten + kEqOffset);
static_assert(kColorDodge_GrBlendEquation == (int)SkBlendMode::kColorDodge + kEqOffset); static_assert((int)skgpu::BlendEquation::kColorDodge == (int)SkBlendMode::kColorDodge + kEqOffset);
static_assert(kColorBurn_GrBlendEquation == (int)SkBlendMode::kColorBurn + kEqOffset); static_assert((int)skgpu::BlendEquation::kColorBurn == (int)SkBlendMode::kColorBurn + kEqOffset);
static_assert(kHardLight_GrBlendEquation == (int)SkBlendMode::kHardLight + kEqOffset); static_assert((int)skgpu::BlendEquation::kHardLight == (int)SkBlendMode::kHardLight + kEqOffset);
static_assert(kSoftLight_GrBlendEquation == (int)SkBlendMode::kSoftLight + kEqOffset); static_assert((int)skgpu::BlendEquation::kSoftLight == (int)SkBlendMode::kSoftLight + kEqOffset);
static_assert(kDifference_GrBlendEquation == (int)SkBlendMode::kDifference + kEqOffset); static_assert((int)skgpu::BlendEquation::kDifference == (int)SkBlendMode::kDifference + kEqOffset);
static_assert(kExclusion_GrBlendEquation == (int)SkBlendMode::kExclusion + kEqOffset); static_assert((int)skgpu::BlendEquation::kExclusion == (int)SkBlendMode::kExclusion + kEqOffset);
static_assert(kMultiply_GrBlendEquation == (int)SkBlendMode::kMultiply + kEqOffset); static_assert((int)skgpu::BlendEquation::kMultiply == (int)SkBlendMode::kMultiply + kEqOffset);
static_assert(kHSLHue_GrBlendEquation == (int)SkBlendMode::kHue + kEqOffset); static_assert((int)skgpu::BlendEquation::kHSLHue == (int)SkBlendMode::kHue + kEqOffset);
static_assert(kHSLSaturation_GrBlendEquation == (int)SkBlendMode::kSaturation + kEqOffset); static_assert((int)skgpu::BlendEquation::kHSLSaturation == (int)SkBlendMode::kSaturation + kEqOffset);
static_assert(kHSLColor_GrBlendEquation == (int)SkBlendMode::kColor + kEqOffset); static_assert((int)skgpu::BlendEquation::kHSLColor == (int)SkBlendMode::kColor + kEqOffset);
static_assert(kHSLLuminosity_GrBlendEquation == (int)SkBlendMode::kLuminosity + kEqOffset); static_assert((int)skgpu::BlendEquation::kHSLLuminosity == (int)SkBlendMode::kLuminosity + kEqOffset);
// There's an illegal GrBlendEquation that corresponds to no SkBlendMode, hence the extra +1. // There's an illegal BlendEquation that corresponds to no SkBlendMode, hence the extra +1.
static_assert(kGrBlendEquationCnt == (int)SkBlendMode::kLastMode + 1 + 1 + kEqOffset); static_assert(skgpu::kBlendEquationCnt == (int)SkBlendMode::kLastMode + 1 + 1 + kEqOffset);
return static_cast<GrBlendEquation>((int)mode + kEqOffset); return static_cast<skgpu::BlendEquation>((int)mode + kEqOffset);
#undef EQ_OFFSET #undef EQ_OFFSET
} }
static bool can_use_hw_blend_equation(GrBlendEquation equation, static bool can_use_hw_blend_equation(skgpu::BlendEquation equation,
GrProcessorAnalysisCoverage coverage, const GrCaps& caps) { GrProcessorAnalysisCoverage coverage, const GrCaps& caps) {
if (!caps.advancedBlendEquationSupport()) { if (!caps.advancedBlendEquationSupport()) {
return false; return false;
@ -72,7 +72,7 @@ static bool can_use_hw_blend_equation(GrBlendEquation equation,
class CustomXP : public GrXferProcessor { class CustomXP : public GrXferProcessor {
public: public:
CustomXP(SkBlendMode mode, GrBlendEquation hwBlendEquation) CustomXP(SkBlendMode mode, skgpu::BlendEquation hwBlendEquation)
: INHERITED(kCustomXP_ClassID) : INHERITED(kCustomXP_ClassID)
, fMode(mode) , fMode(mode)
, fHWBlendEquation(hwBlendEquation) {} , fHWBlendEquation(hwBlendEquation) {}
@ -80,7 +80,7 @@ public:
CustomXP(SkBlendMode mode, GrProcessorAnalysisCoverage coverage) CustomXP(SkBlendMode mode, GrProcessorAnalysisCoverage coverage)
: INHERITED(kCustomXP_ClassID, /*willReadDstColor=*/true, coverage) : INHERITED(kCustomXP_ClassID, /*willReadDstColor=*/true, coverage)
, fMode(mode) , fMode(mode)
, fHWBlendEquation(kIllegal_GrBlendEquation) { , fHWBlendEquation(skgpu::BlendEquation::kIllegal) {
} }
const char* name() const override { return "Custom Xfermode"; } const char* name() const override { return "Custom Xfermode"; }
@ -90,7 +90,7 @@ public:
GrXferBarrierType xferBarrierType(const GrCaps&) const override; GrXferBarrierType xferBarrierType(const GrCaps&) const override;
private: private:
bool hasHWBlendEquation() const { return kIllegal_GrBlendEquation != fHWBlendEquation; } bool hasHWBlendEquation() const { return skgpu::BlendEquation::kIllegal != fHWBlendEquation; }
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override; void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
@ -98,8 +98,8 @@ private:
bool onIsEqual(const GrXferProcessor& xpBase) const override; bool onIsEqual(const GrXferProcessor& xpBase) const override;
const SkBlendMode fMode; const SkBlendMode fMode;
const GrBlendEquation fHWBlendEquation; const skgpu::BlendEquation fHWBlendEquation;
using INHERITED = GrXferProcessor; using INHERITED = GrXferProcessor;
}; };
@ -210,7 +210,7 @@ private:
GR_DECLARE_XP_FACTORY_TEST GR_DECLARE_XP_FACTORY_TEST
SkBlendMode fMode; SkBlendMode fMode;
GrBlendEquation fHWBlendEquation; skgpu::BlendEquation fHWBlendEquation;
using INHERITED = GrXPFactory; using INHERITED = GrXPFactory;
}; };

View File

@ -10,7 +10,7 @@
#include "include/gpu/GrTypes.h" #include "include/gpu/GrTypes.h"
#include "include/private/SkMacros.h" #include "include/private/SkMacros.h"
#include "include/private/SkTo.h" #include "include/private/SkTo.h"
#include "src/gpu/GrBlend.h" #include "src/gpu/Blend.h"
#include "src/gpu/GrCaps.h" #include "src/gpu/GrCaps.h"
#include "src/gpu/GrPipeline.h" #include "src/gpu/GrPipeline.h"
#include "src/gpu/GrProcessor.h" #include "src/gpu/GrProcessor.h"
@ -42,13 +42,16 @@ public:
kLast_OutputType = kISCModulate_OutputType kLast_OutputType = kISCModulate_OutputType
}; };
constexpr BlendFormula(OutputType primaryOut, OutputType secondaryOut, GrBlendEquation equation, constexpr BlendFormula(OutputType primaryOut,
GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff) OutputType secondaryOut,
skgpu::BlendEquation equation,
skgpu::BlendCoeff srcCoeff,
skgpu::BlendCoeff dstCoeff)
: fPrimaryOutputType(primaryOut) : fPrimaryOutputType(primaryOut)
, fSecondaryOutputType(secondaryOut) , fSecondaryOutputType(secondaryOut)
, fBlendEquation(equation) , fBlendEquation(SkTo<uint8_t>(equation))
, fSrcCoeff(srcCoeff) , fSrcCoeff(SkTo<uint8_t>(srcCoeff))
, fDstCoeff(dstCoeff) , fDstCoeff(SkTo<uint8_t>(dstCoeff))
, fProps(GetProperties(primaryOut, secondaryOut, equation, srcCoeff, dstCoeff)) {} , fProps(GetProperties(primaryOut, secondaryOut, equation, srcCoeff, dstCoeff)) {}
BlendFormula(const BlendFormula&) = default; BlendFormula(const BlendFormula&) = default;
@ -84,16 +87,16 @@ public:
return SkToBool(fProps & kCanTweakAlphaForCoverage_Property); return SkToBool(fProps & kCanTweakAlphaForCoverage_Property);
} }
GrBlendEquation equation() const { skgpu::BlendEquation equation() const {
return fBlendEquation; return static_cast<skgpu::BlendEquation>(fBlendEquation);
} }
GrBlendCoeff srcCoeff() const { skgpu::BlendCoeff srcCoeff() const {
return fSrcCoeff; return static_cast<skgpu::BlendCoeff>(fSrcCoeff);
} }
GrBlendCoeff dstCoeff() const { skgpu::BlendCoeff dstCoeff() const {
return fDstCoeff; return static_cast<skgpu::BlendCoeff>(fDstCoeff);
} }
OutputType primaryOutput() const { OutputType primaryOutput() const {
@ -119,25 +122,27 @@ private:
/** /**
* Deduce the properties of a BlendFormula. * Deduce the properties of a BlendFormula.
*/ */
static constexpr Properties GetProperties(OutputType PrimaryOut, OutputType SecondaryOut, static constexpr Properties GetProperties(OutputType PrimaryOut,
GrBlendEquation BlendEquation, GrBlendCoeff SrcCoeff, OutputType SecondaryOut,
GrBlendCoeff DstCoeff); skgpu::BlendEquation BlendEquation,
skgpu::BlendCoeff SrcCoeff,
skgpu::BlendCoeff DstCoeff);
struct { struct {
// We allot the enums one more bit than they require because MSVC seems to sign-extend // We allot the enums one more bit than they require because MSVC seems to sign-extend
// them when the top bit is set. (This is in violation of the C++03 standard 9.6/4) // them when the top bit is set. (This is in violation of the C++03 standard 9.6/4)
OutputType fPrimaryOutputType : 4; OutputType fPrimaryOutputType : 4;
OutputType fSecondaryOutputType : 4; OutputType fSecondaryOutputType : 4;
GrBlendEquation fBlendEquation : 6; uint32_t fBlendEquation : 6;
GrBlendCoeff fSrcCoeff : 6; uint32_t fSrcCoeff : 6;
GrBlendCoeff fDstCoeff : 6; uint32_t fDstCoeff : 6;
Properties fProps : 32 - (4 + 4 + 6 + 6 + 6); Properties fProps : 32 - (4 + 4 + 6 + 6 + 6);
}; };
static_assert(kLast_OutputType < (1 << 3)); static_assert(kLast_OutputType < (1 << 3));
static_assert(kLast_GrBlendEquation < (1 << 5)); static_assert(static_cast<int>(skgpu::BlendEquation::kLast) < (1 << 5));
static_assert(kLast_GrBlendCoeff < (1 << 5)); static_assert(static_cast<int>(skgpu::BlendCoeff::kLast) < (1 << 5));
static_assert(kLast_Property < (1 << 6)); static_assert(kLast_Property < (1 << 6));
}; };
static_assert(4 == sizeof(BlendFormula)); static_assert(4 == sizeof(BlendFormula));
@ -146,34 +151,36 @@ SK_MAKE_BITFIELD_OPS(BlendFormula::Properties)
constexpr BlendFormula::Properties BlendFormula::GetProperties(OutputType PrimaryOut, constexpr BlendFormula::Properties BlendFormula::GetProperties(OutputType PrimaryOut,
OutputType SecondaryOut, OutputType SecondaryOut,
GrBlendEquation BlendEquation, skgpu::BlendEquation BlendEquation,
GrBlendCoeff SrcCoeff, skgpu::BlendCoeff SrcCoeff,
GrBlendCoeff DstCoeff) { skgpu::BlendCoeff DstCoeff) {
return return
// The provided formula should already be optimized before a BlendFormula is constructed. // The provided formula should already be optimized before a BlendFormula is constructed.
// Assert that here while setting up the properties in the constexpr constructor. // Assert that here while setting up the properties in the constexpr constructor.
SkASSERT((kNone_OutputType == PrimaryOut) == !GrBlendCoeffsUseSrcColor(SrcCoeff, DstCoeff)), SkASSERT((kNone_OutputType == PrimaryOut) ==
SkASSERT(!GrBlendCoeffRefsSrc2(SrcCoeff)), !skgpu::BlendCoeffsUseSrcColor(SrcCoeff, DstCoeff)),
SkASSERT((kNone_OutputType == SecondaryOut) == !GrBlendCoeffRefsSrc2(DstCoeff)), SkASSERT(!skgpu::BlendCoeffRefsSrc2(SrcCoeff)),
SkASSERT((kNone_OutputType == SecondaryOut) == !skgpu::BlendCoeffRefsSrc2(DstCoeff)),
SkASSERT(PrimaryOut != SecondaryOut || kNone_OutputType == PrimaryOut), SkASSERT(PrimaryOut != SecondaryOut || kNone_OutputType == PrimaryOut),
SkASSERT(kNone_OutputType != PrimaryOut || kNone_OutputType == SecondaryOut), SkASSERT(kNone_OutputType != PrimaryOut || kNone_OutputType == SecondaryOut),
static_cast<Properties>( static_cast<Properties>(
(GrBlendModifiesDst(BlendEquation, SrcCoeff, DstCoeff) ? kModifiesDst_Property : 0) | (skgpu::BlendModifiesDst(BlendEquation, SrcCoeff, DstCoeff) ? kModifiesDst_Property : 0) |
(!GrBlendCoeffsUseDstColor(SrcCoeff, DstCoeff, false/*srcColorIsOpaque*/) (!skgpu::BlendCoeffsUseDstColor(SrcCoeff, DstCoeff, false/*srcColorIsOpaque*/)
? kUnaffectedByDst_Property ? kUnaffectedByDst_Property
: 0) | : 0) |
(!GrBlendCoeffsUseDstColor(SrcCoeff, DstCoeff, true/*srcColorIsOpaque*/) (!skgpu::BlendCoeffsUseDstColor(SrcCoeff, DstCoeff, true/*srcColorIsOpaque*/)
? kUnaffectedByDstIfOpaque_Property ? kUnaffectedByDstIfOpaque_Property
: 0) | : 0) |
((PrimaryOut >= kModulate_OutputType && GrBlendCoeffsUseSrcColor(SrcCoeff, DstCoeff)) || ((PrimaryOut >= kModulate_OutputType &&
skgpu::BlendCoeffsUseSrcColor(SrcCoeff, DstCoeff)) ||
(SecondaryOut >= kModulate_OutputType && (SecondaryOut >= kModulate_OutputType &&
GrBlendCoeffRefsSrc2(DstCoeff)) skgpu::BlendCoeffRefsSrc2(DstCoeff))
? kUsesInputColor_Property ? kUsesInputColor_Property
: 0) | // We assert later that SrcCoeff doesn't ref src2. : 0) | // We assert later that SrcCoeff doesn't ref src2.
((kModulate_OutputType == PrimaryOut || kNone_OutputType == PrimaryOut) && ((kModulate_OutputType == PrimaryOut || kNone_OutputType == PrimaryOut) &&
kNone_OutputType == SecondaryOut && kNone_OutputType == SecondaryOut &&
GrBlendAllowsCoverageAsAlpha(BlendEquation, SrcCoeff, DstCoeff) skgpu::BlendAllowsCoverageAsAlpha(BlendEquation, SrcCoeff, DstCoeff)
? kCanTweakAlphaForCoverage_Property ? kCanTweakAlphaForCoverage_Property
: 0)); : 0));
} }
@ -182,23 +189,25 @@ constexpr BlendFormula::Properties BlendFormula::GetProperties(OutputType Primar
* When there is no coverage, or the blend mode can tweak alpha for coverage, we use the standard * When there is no coverage, or the blend mode can tweak alpha for coverage, we use the standard
* Porter Duff formula. * Porter Duff formula.
*/ */
static constexpr BlendFormula MakeCoeffFormula(GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff) { static constexpr BlendFormula MakeCoeffFormula(skgpu::BlendCoeff srcCoeff,
skgpu::BlendCoeff dstCoeff) {
// When the coeffs are (Zero, Zero) or (Zero, One) we set the primary output to none. // When the coeffs are (Zero, Zero) or (Zero, One) we set the primary output to none.
return (kZero_GrBlendCoeff == srcCoeff && return (skgpu::BlendCoeff::kZero == srcCoeff &&
(kZero_GrBlendCoeff == dstCoeff || kOne_GrBlendCoeff == dstCoeff)) (skgpu::BlendCoeff::kZero == dstCoeff || skgpu::BlendCoeff::kOne == dstCoeff))
? BlendFormula(BlendFormula::kNone_OutputType, BlendFormula::kNone_OutputType, ? BlendFormula(BlendFormula::kNone_OutputType, BlendFormula::kNone_OutputType,
kAdd_GrBlendEquation, kZero_GrBlendCoeff, dstCoeff) skgpu::BlendEquation::kAdd, skgpu::BlendCoeff::kZero, dstCoeff)
: BlendFormula(BlendFormula::kModulate_OutputType, BlendFormula::kNone_OutputType, : BlendFormula(BlendFormula::kModulate_OutputType, BlendFormula::kNone_OutputType,
kAdd_GrBlendEquation, srcCoeff, dstCoeff); skgpu::BlendEquation::kAdd, srcCoeff, dstCoeff);
} }
/** /**
* Basic coeff formula similar to MakeCoeffFormula but we will make the src f*Sa. This is used in * Basic coeff formula similar to MakeCoeffFormula but we will make the src f*Sa. This is used in
* LCD dst-out. * LCD dst-out.
*/ */
static constexpr BlendFormula MakeSAModulateFormula(GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff) { static constexpr BlendFormula MakeSAModulateFormula(skgpu::BlendCoeff srcCoeff,
skgpu::BlendCoeff dstCoeff) {
return BlendFormula(BlendFormula::kSAModulate_OutputType, BlendFormula::kNone_OutputType, return BlendFormula(BlendFormula::kSAModulate_OutputType, BlendFormula::kNone_OutputType,
kAdd_GrBlendEquation, srcCoeff, dstCoeff); skgpu::BlendEquation::kAdd, srcCoeff, dstCoeff);
} }
/** /**
@ -216,9 +225,9 @@ static constexpr BlendFormula MakeSAModulateFormula(GrBlendCoeff srcCoeff, GrBle
* Xfer modes: dst-atop (Sa!=1) * Xfer modes: dst-atop (Sa!=1)
*/ */
static constexpr BlendFormula MakeCoverageFormula( static constexpr BlendFormula MakeCoverageFormula(
BlendFormula::OutputType oneMinusDstCoeffModulateOutput, GrBlendCoeff srcCoeff) { BlendFormula::OutputType oneMinusDstCoeffModulateOutput, skgpu::BlendCoeff srcCoeff) {
return BlendFormula(BlendFormula::kModulate_OutputType, oneMinusDstCoeffModulateOutput, return BlendFormula(BlendFormula::kModulate_OutputType, oneMinusDstCoeffModulateOutput,
kAdd_GrBlendEquation, srcCoeff, kIS2C_GrBlendCoeff); skgpu::BlendEquation::kAdd, srcCoeff, skgpu::BlendCoeff::kIS2C);
} }
/** /**
@ -238,7 +247,8 @@ static constexpr BlendFormula MakeCoverageFormula(
static constexpr BlendFormula MakeCoverageSrcCoeffZeroFormula( static constexpr BlendFormula MakeCoverageSrcCoeffZeroFormula(
BlendFormula::OutputType oneMinusDstCoeffModulateOutput) { BlendFormula::OutputType oneMinusDstCoeffModulateOutput) {
return BlendFormula(oneMinusDstCoeffModulateOutput, BlendFormula::kNone_OutputType, return BlendFormula(oneMinusDstCoeffModulateOutput, BlendFormula::kNone_OutputType,
kReverseSubtract_GrBlendEquation, kDC_GrBlendCoeff, kOne_GrBlendCoeff); skgpu::BlendEquation::kReverseSubtract, skgpu::BlendCoeff::kDC,
skgpu::BlendCoeff::kOne);
} }
/** /**
@ -251,9 +261,9 @@ static constexpr BlendFormula MakeCoverageSrcCoeffZeroFormula(
* *
* Xfer modes (Sa!=1): src, src-in, src-out * Xfer modes (Sa!=1): src, src-in, src-out
*/ */
static constexpr BlendFormula MakeCoverageDstCoeffZeroFormula(GrBlendCoeff srcCoeff) { static constexpr BlendFormula MakeCoverageDstCoeffZeroFormula(skgpu::BlendCoeff srcCoeff) {
return BlendFormula(BlendFormula::kModulate_OutputType, BlendFormula::kCoverage_OutputType, return BlendFormula(BlendFormula::kModulate_OutputType, BlendFormula::kCoverage_OutputType,
kAdd_GrBlendEquation, srcCoeff, kIS2A_GrBlendCoeff); skgpu::BlendEquation::kAdd, srcCoeff, skgpu::BlendCoeff::kIS2A);
} }
/** /**
@ -264,75 +274,77 @@ static constexpr BlendFormula MakeCoverageDstCoeffZeroFormula(GrBlendCoeff srcCo
static constexpr BlendFormula gBlendTable[2][2][(int)SkBlendMode::kLastCoeffMode + 1] = { static constexpr BlendFormula gBlendTable[2][2][(int)SkBlendMode::kLastCoeffMode + 1] = {
/*>> No coverage, input color unknown <<*/ {{ /*>> No coverage, input color unknown <<*/ {{
/* clear */ MakeCoeffFormula(kZero_GrBlendCoeff, kZero_GrBlendCoeff), /* clear */ MakeCoeffFormula(skgpu::BlendCoeff::kZero, skgpu::BlendCoeff::kZero),
/* src */ MakeCoeffFormula(kOne_GrBlendCoeff, kZero_GrBlendCoeff), /* src */ MakeCoeffFormula(skgpu::BlendCoeff::kOne, skgpu::BlendCoeff::kZero),
/* dst */ MakeCoeffFormula(kZero_GrBlendCoeff, kOne_GrBlendCoeff), /* dst */ MakeCoeffFormula(skgpu::BlendCoeff::kZero, skgpu::BlendCoeff::kOne),
/* src-over */ MakeCoeffFormula(kOne_GrBlendCoeff, kISA_GrBlendCoeff), /* src-over */ MakeCoeffFormula(skgpu::BlendCoeff::kOne, skgpu::BlendCoeff::kISA),
/* dst-over */ MakeCoeffFormula(kIDA_GrBlendCoeff, kOne_GrBlendCoeff), /* dst-over */ MakeCoeffFormula(skgpu::BlendCoeff::kIDA, skgpu::BlendCoeff::kOne),
/* src-in */ MakeCoeffFormula(kDA_GrBlendCoeff, kZero_GrBlendCoeff), /* src-in */ MakeCoeffFormula(skgpu::BlendCoeff::kDA, skgpu::BlendCoeff::kZero),
/* dst-in */ MakeCoeffFormula(kZero_GrBlendCoeff, kSA_GrBlendCoeff), /* dst-in */ MakeCoeffFormula(skgpu::BlendCoeff::kZero, skgpu::BlendCoeff::kSA),
/* src-out */ MakeCoeffFormula(kIDA_GrBlendCoeff, kZero_GrBlendCoeff), /* src-out */ MakeCoeffFormula(skgpu::BlendCoeff::kIDA, skgpu::BlendCoeff::kZero),
/* dst-out */ MakeCoeffFormula(kZero_GrBlendCoeff, kISA_GrBlendCoeff), /* dst-out */ MakeCoeffFormula(skgpu::BlendCoeff::kZero, skgpu::BlendCoeff::kISA),
/* src-atop */ MakeCoeffFormula(kDA_GrBlendCoeff, kISA_GrBlendCoeff), /* src-atop */ MakeCoeffFormula(skgpu::BlendCoeff::kDA, skgpu::BlendCoeff::kISA),
/* dst-atop */ MakeCoeffFormula(kIDA_GrBlendCoeff, kSA_GrBlendCoeff), /* dst-atop */ MakeCoeffFormula(skgpu::BlendCoeff::kIDA, skgpu::BlendCoeff::kSA),
/* xor */ MakeCoeffFormula(kIDA_GrBlendCoeff, kISA_GrBlendCoeff), /* xor */ MakeCoeffFormula(skgpu::BlendCoeff::kIDA, skgpu::BlendCoeff::kISA),
/* plus */ MakeCoeffFormula(kOne_GrBlendCoeff, kOne_GrBlendCoeff), /* plus */ MakeCoeffFormula(skgpu::BlendCoeff::kOne, skgpu::BlendCoeff::kOne),
/* modulate */ MakeCoeffFormula(kZero_GrBlendCoeff, kSC_GrBlendCoeff), /* modulate */ MakeCoeffFormula(skgpu::BlendCoeff::kZero, skgpu::BlendCoeff::kSC),
/* screen */ MakeCoeffFormula(kOne_GrBlendCoeff, kISC_GrBlendCoeff), /* screen */ MakeCoeffFormula(skgpu::BlendCoeff::kOne, skgpu::BlendCoeff::kISC),
}, /*>> Has coverage, input color unknown <<*/ { }, /*>> Has coverage, input color unknown <<*/ {
/* clear */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kCoverage_OutputType), /* clear */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kCoverage_OutputType),
/* src */ MakeCoverageDstCoeffZeroFormula(kOne_GrBlendCoeff), /* src */ MakeCoverageDstCoeffZeroFormula(skgpu::BlendCoeff::kOne),
/* dst */ MakeCoeffFormula(kZero_GrBlendCoeff, kOne_GrBlendCoeff), /* dst */ MakeCoeffFormula(skgpu::BlendCoeff::kZero, skgpu::BlendCoeff::kOne),
/* src-over */ MakeCoeffFormula(kOne_GrBlendCoeff, kISA_GrBlendCoeff), /* src-over */ MakeCoeffFormula(skgpu::BlendCoeff::kOne, skgpu::BlendCoeff::kISA),
/* dst-over */ MakeCoeffFormula(kIDA_GrBlendCoeff, kOne_GrBlendCoeff), /* dst-over */ MakeCoeffFormula(skgpu::BlendCoeff::kIDA, skgpu::BlendCoeff::kOne),
/* src-in */ MakeCoverageDstCoeffZeroFormula(kDA_GrBlendCoeff), /* src-in */ MakeCoverageDstCoeffZeroFormula(skgpu::BlendCoeff::kDA),
/* dst-in */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kISAModulate_OutputType), /* dst-in */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kISAModulate_OutputType),
/* src-out */ MakeCoverageDstCoeffZeroFormula(kIDA_GrBlendCoeff), /* src-out */ MakeCoverageDstCoeffZeroFormula(skgpu::BlendCoeff::kIDA),
/* dst-out */ MakeCoeffFormula(kZero_GrBlendCoeff, kISA_GrBlendCoeff), /* dst-out */ MakeCoeffFormula(skgpu::BlendCoeff::kZero, skgpu::BlendCoeff::kISA),
/* src-atop */ MakeCoeffFormula(kDA_GrBlendCoeff, kISA_GrBlendCoeff), /* src-atop */ MakeCoeffFormula(skgpu::BlendCoeff::kDA, skgpu::BlendCoeff::kISA),
/* dst-atop */ MakeCoverageFormula(BlendFormula::kISAModulate_OutputType, kIDA_GrBlendCoeff), /* dst-atop */ MakeCoverageFormula(BlendFormula::kISAModulate_OutputType,
/* xor */ MakeCoeffFormula(kIDA_GrBlendCoeff, kISA_GrBlendCoeff), skgpu::BlendCoeff::kIDA),
/* plus */ MakeCoeffFormula(kOne_GrBlendCoeff, kOne_GrBlendCoeff), /* xor */ MakeCoeffFormula(skgpu::BlendCoeff::kIDA, skgpu::BlendCoeff::kISA),
/* plus */ MakeCoeffFormula(skgpu::BlendCoeff::kOne, skgpu::BlendCoeff::kOne),
/* modulate */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kISCModulate_OutputType), /* modulate */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kISCModulate_OutputType),
/* screen */ MakeCoeffFormula(kOne_GrBlendCoeff, kISC_GrBlendCoeff), /* screen */ MakeCoeffFormula(skgpu::BlendCoeff::kOne, skgpu::BlendCoeff::kISC),
}}, /*>> No coverage, input color opaque <<*/ {{ }}, /*>> No coverage, input color opaque <<*/ {{
/* clear */ MakeCoeffFormula(kZero_GrBlendCoeff, kZero_GrBlendCoeff), /* clear */ MakeCoeffFormula(skgpu::BlendCoeff::kZero, skgpu::BlendCoeff::kZero),
/* src */ MakeCoeffFormula(kOne_GrBlendCoeff, kZero_GrBlendCoeff), /* src */ MakeCoeffFormula(skgpu::BlendCoeff::kOne, skgpu::BlendCoeff::kZero),
/* dst */ MakeCoeffFormula(kZero_GrBlendCoeff, kOne_GrBlendCoeff), /* dst */ MakeCoeffFormula(skgpu::BlendCoeff::kZero, skgpu::BlendCoeff::kOne),
/* src-over */ MakeCoeffFormula(kOne_GrBlendCoeff, kISA_GrBlendCoeff), // see comment below /* src-over */ MakeCoeffFormula(skgpu::BlendCoeff::kOne,
/* dst-over */ MakeCoeffFormula(kIDA_GrBlendCoeff, kOne_GrBlendCoeff), skgpu::BlendCoeff::kISA), // see comment below
/* src-in */ MakeCoeffFormula(kDA_GrBlendCoeff, kZero_GrBlendCoeff), /* dst-over */ MakeCoeffFormula(skgpu::BlendCoeff::kIDA, skgpu::BlendCoeff::kOne),
/* dst-in */ MakeCoeffFormula(kZero_GrBlendCoeff, kOne_GrBlendCoeff), /* src-in */ MakeCoeffFormula(skgpu::BlendCoeff::kDA, skgpu::BlendCoeff::kZero),
/* src-out */ MakeCoeffFormula(kIDA_GrBlendCoeff, kZero_GrBlendCoeff), /* dst-in */ MakeCoeffFormula(skgpu::BlendCoeff::kZero, skgpu::BlendCoeff::kOne),
/* dst-out */ MakeCoeffFormula(kZero_GrBlendCoeff, kZero_GrBlendCoeff), /* src-out */ MakeCoeffFormula(skgpu::BlendCoeff::kIDA, skgpu::BlendCoeff::kZero),
/* src-atop */ MakeCoeffFormula(kDA_GrBlendCoeff, kZero_GrBlendCoeff), /* dst-out */ MakeCoeffFormula(skgpu::BlendCoeff::kZero, skgpu::BlendCoeff::kZero),
/* dst-atop */ MakeCoeffFormula(kIDA_GrBlendCoeff, kOne_GrBlendCoeff), /* src-atop */ MakeCoeffFormula(skgpu::BlendCoeff::kDA, skgpu::BlendCoeff::kZero),
/* xor */ MakeCoeffFormula(kIDA_GrBlendCoeff, kZero_GrBlendCoeff), /* dst-atop */ MakeCoeffFormula(skgpu::BlendCoeff::kIDA, skgpu::BlendCoeff::kOne),
/* plus */ MakeCoeffFormula(kOne_GrBlendCoeff, kOne_GrBlendCoeff), /* xor */ MakeCoeffFormula(skgpu::BlendCoeff::kIDA, skgpu::BlendCoeff::kZero),
/* modulate */ MakeCoeffFormula(kZero_GrBlendCoeff, kSC_GrBlendCoeff), /* plus */ MakeCoeffFormula(skgpu::BlendCoeff::kOne, skgpu::BlendCoeff::kOne),
/* screen */ MakeCoeffFormula(kOne_GrBlendCoeff, kISC_GrBlendCoeff), /* modulate */ MakeCoeffFormula(skgpu::BlendCoeff::kZero, skgpu::BlendCoeff::kSC),
/* screen */ MakeCoeffFormula(skgpu::BlendCoeff::kOne, skgpu::BlendCoeff::kISC),
}, /*>> Has coverage, input color opaque <<*/ { }, /*>> Has coverage, input color opaque <<*/ {
/* clear */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kCoverage_OutputType), /* clear */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kCoverage_OutputType),
/* src */ MakeCoeffFormula(kOne_GrBlendCoeff, kISA_GrBlendCoeff), /* src */ MakeCoeffFormula(skgpu::BlendCoeff::kOne, skgpu::BlendCoeff::kISA),
/* dst */ MakeCoeffFormula(kZero_GrBlendCoeff, kOne_GrBlendCoeff), /* dst */ MakeCoeffFormula(skgpu::BlendCoeff::kZero, skgpu::BlendCoeff::kOne),
/* src-over */ MakeCoeffFormula(kOne_GrBlendCoeff, kISA_GrBlendCoeff), /* src-over */ MakeCoeffFormula(skgpu::BlendCoeff::kOne, skgpu::BlendCoeff::kISA),
/* dst-over */ MakeCoeffFormula(kIDA_GrBlendCoeff, kOne_GrBlendCoeff), /* dst-over */ MakeCoeffFormula(skgpu::BlendCoeff::kIDA, skgpu::BlendCoeff::kOne),
/* src-in */ MakeCoeffFormula(kDA_GrBlendCoeff, kISA_GrBlendCoeff), /* src-in */ MakeCoeffFormula(skgpu::BlendCoeff::kDA, skgpu::BlendCoeff::kISA),
/* dst-in */ MakeCoeffFormula(kZero_GrBlendCoeff, kOne_GrBlendCoeff), /* dst-in */ MakeCoeffFormula(skgpu::BlendCoeff::kZero, skgpu::BlendCoeff::kOne),
/* src-out */ MakeCoeffFormula(kIDA_GrBlendCoeff, kISA_GrBlendCoeff), /* src-out */ MakeCoeffFormula(skgpu::BlendCoeff::kIDA, skgpu::BlendCoeff::kISA),
/* dst-out */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kCoverage_OutputType), /* dst-out */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kCoverage_OutputType),
/* src-atop */ MakeCoeffFormula(kDA_GrBlendCoeff, kISA_GrBlendCoeff), /* src-atop */ MakeCoeffFormula(skgpu::BlendCoeff::kDA, skgpu::BlendCoeff::kISA),
/* dst-atop */ MakeCoeffFormula(kIDA_GrBlendCoeff, kOne_GrBlendCoeff), /* dst-atop */ MakeCoeffFormula(skgpu::BlendCoeff::kIDA, skgpu::BlendCoeff::kOne),
/* xor */ MakeCoeffFormula(kIDA_GrBlendCoeff, kISA_GrBlendCoeff), /* xor */ MakeCoeffFormula(skgpu::BlendCoeff::kIDA, skgpu::BlendCoeff::kISA),
/* plus */ MakeCoeffFormula(kOne_GrBlendCoeff, kOne_GrBlendCoeff), /* plus */ MakeCoeffFormula(skgpu::BlendCoeff::kOne, skgpu::BlendCoeff::kOne),
/* modulate */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kISCModulate_OutputType), /* modulate */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kISCModulate_OutputType),
/* screen */ MakeCoeffFormula(kOne_GrBlendCoeff, kISC_GrBlendCoeff), /* screen */ MakeCoeffFormula(skgpu::BlendCoeff::kOne, skgpu::BlendCoeff::kISC),
}}}; }}};
// In the above table src-over is not optimized to src mode when the color is opaque because we // In the above table src-over is not optimized to src mode when the color is opaque because we
// found no advantage to doing so. Also, we are using a global src-over XP in most cases which is // found no advantage to doing so. Also, we are using a global src-over XP in most cases which is
@ -341,20 +353,32 @@ static constexpr BlendFormula gBlendTable[2][2][(int)SkBlendMode::kLastCoeffMode
// this table. // this table.
static constexpr BlendFormula gLCDBlendTable[(int)SkBlendMode::kLastCoeffMode + 1] = { static constexpr BlendFormula gLCDBlendTable[(int)SkBlendMode::kLastCoeffMode + 1] = {
/* clear */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kCoverage_OutputType), /* clear */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kCoverage_OutputType),
/* src */ MakeCoverageFormula(BlendFormula::kCoverage_OutputType, kOne_GrBlendCoeff), /* src */ MakeCoverageFormula(BlendFormula::kCoverage_OutputType,
/* dst */ MakeCoeffFormula(kZero_GrBlendCoeff, kOne_GrBlendCoeff), skgpu::BlendCoeff::kOne),
/* src-over */ MakeCoverageFormula(BlendFormula::kSAModulate_OutputType, kOne_GrBlendCoeff), /* dst */ MakeCoeffFormula(skgpu::BlendCoeff::kZero,
/* dst-over */ MakeCoeffFormula(kIDA_GrBlendCoeff, kOne_GrBlendCoeff), skgpu::BlendCoeff::kOne),
/* src-in */ MakeCoverageFormula(BlendFormula::kCoverage_OutputType, kDA_GrBlendCoeff), /* src-over */ MakeCoverageFormula(BlendFormula::kSAModulate_OutputType,
skgpu::BlendCoeff::kOne),
/* dst-over */ MakeCoeffFormula(skgpu::BlendCoeff::kIDA,
skgpu::BlendCoeff::kOne),
/* src-in */ MakeCoverageFormula(BlendFormula::kCoverage_OutputType,
skgpu::BlendCoeff::kDA),
/* dst-in */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kISAModulate_OutputType), /* dst-in */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kISAModulate_OutputType),
/* src-out */ MakeCoverageFormula(BlendFormula::kCoverage_OutputType, kIDA_GrBlendCoeff), /* src-out */ MakeCoverageFormula(BlendFormula::kCoverage_OutputType,
/* dst-out */ MakeSAModulateFormula(kZero_GrBlendCoeff, kISC_GrBlendCoeff), skgpu::BlendCoeff::kIDA),
/* src-atop */ MakeCoverageFormula(BlendFormula::kSAModulate_OutputType, kDA_GrBlendCoeff), /* dst-out */ MakeSAModulateFormula(skgpu::BlendCoeff::kZero,
/* dst-atop */ MakeCoverageFormula(BlendFormula::kISAModulate_OutputType, kIDA_GrBlendCoeff), skgpu::BlendCoeff::kISC),
/* xor */ MakeCoverageFormula(BlendFormula::kSAModulate_OutputType, kIDA_GrBlendCoeff), /* src-atop */ MakeCoverageFormula(BlendFormula::kSAModulate_OutputType,
/* plus */ MakeCoeffFormula(kOne_GrBlendCoeff, kOne_GrBlendCoeff), skgpu::BlendCoeff::kDA),
/* dst-atop */ MakeCoverageFormula(BlendFormula::kISAModulate_OutputType,
skgpu::BlendCoeff::kIDA),
/* xor */ MakeCoverageFormula(BlendFormula::kSAModulate_OutputType,
skgpu::BlendCoeff::kIDA),
/* plus */ MakeCoeffFormula(skgpu::BlendCoeff::kOne,
skgpu::BlendCoeff::kOne),
/* modulate */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kISCModulate_OutputType), /* modulate */ MakeCoverageSrcCoeffZeroFormula(BlendFormula::kISCModulate_OutputType),
/* screen */ MakeCoeffFormula(kOne_GrBlendCoeff, kISC_GrBlendCoeff), /* screen */ MakeCoeffFormula(skgpu::BlendCoeff::kOne,
skgpu::BlendCoeff::kISC),
}; };
static BlendFormula get_blend_formula(bool isOpaque, static BlendFormula get_blend_formula(bool isOpaque,
@ -551,8 +575,8 @@ private:
void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {} void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override {}
void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override { void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override {
blendInfo->fSrcBlend = kConstC_GrBlendCoeff; blendInfo->fSrcBlend = skgpu::BlendCoeff::kConstC;
blendInfo->fDstBlend = kISC_GrBlendCoeff; blendInfo->fDstBlend = skgpu::BlendCoeff::kISC;
blendInfo->fBlendConstant = fBlendConstant; blendInfo->fBlendConstant = fBlendConstant;
} }
@ -818,7 +842,7 @@ void GrPorterDuffXPFactory::TestGetXPOutputTypes(const GrXferProcessor* xp,
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
const GrXferProcessor& GrPorterDuffXPFactory::SimpleSrcOverXP() { const GrXferProcessor& GrPorterDuffXPFactory::SimpleSrcOverXP() {
static BlendFormula gSrcOverBlendFormula = static BlendFormula gSrcOverBlendFormula =
MakeCoeffFormula(kOne_GrBlendCoeff, kISA_GrBlendCoeff); MakeCoeffFormula(skgpu::BlendCoeff::kOne, skgpu::BlendCoeff::kISA);
static PorterDuffXferProcessor gSrcOverXP(gSrcOverBlendFormula, static PorterDuffXferProcessor gSrcOverXP(gSrcOverBlendFormula,
GrProcessorAnalysisCoverage::kSingleChannel); GrProcessorAnalysisCoverage::kSingleChannel);
return gSrcOverXP; return gSrcOverXP;

View File

@ -4116,12 +4116,12 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo,
if (ctxInfo.driver() == GrGLDriver::kNVIDIA && if (ctxInfo.driver() == GrGLDriver::kNVIDIA &&
ctxInfo.driverVersion() < GR_GL_DRIVER_VER(355, 00, 0)) { ctxInfo.driverVersion() < GR_GL_DRIVER_VER(355, 00, 0)) {
// Disable color-dodge and color-burn on pre-355.00 NVIDIA. // Disable color-dodge and color-burn on pre-355.00 NVIDIA.
fAdvBlendEqDisableFlags |= (1 << kColorDodge_GrBlendEquation) | fAdvBlendEqDisableFlags |= (1 << static_cast<int>(skgpu::BlendEquation::kColorDodge)) |
(1 << kColorBurn_GrBlendEquation); (1 << static_cast<int>(skgpu::BlendEquation::kColorBurn));
} }
if (ctxInfo.vendor() == GrGLVendor::kARM) { if (ctxInfo.vendor() == GrGLVendor::kARM) {
// Disable color-burn on ARM until the fix is released. // Disable color-burn on ARM until the fix is released.
fAdvBlendEqDisableFlags |= (1 << kColorBurn_GrBlendEquation); fAdvBlendEqDisableFlags |= (1 << static_cast<int>(skgpu::BlendEquation::kColorBurn));
} }
} }

View File

@ -90,25 +90,25 @@ static const GrGLenum gXfermodeEquation2Blend[] = {
// Illegal... needs to map to something. // Illegal... needs to map to something.
GR_GL_FUNC_ADD, GR_GL_FUNC_ADD,
}; };
static_assert(0 == kAdd_GrBlendEquation); static_assert(0 == (int)skgpu::BlendEquation::kAdd);
static_assert(1 == kSubtract_GrBlendEquation); static_assert(1 == (int)skgpu::BlendEquation::kSubtract);
static_assert(2 == kReverseSubtract_GrBlendEquation); static_assert(2 == (int)skgpu::BlendEquation::kReverseSubtract);
static_assert(3 == kScreen_GrBlendEquation); static_assert(3 == (int)skgpu::BlendEquation::kScreen);
static_assert(4 == kOverlay_GrBlendEquation); static_assert(4 == (int)skgpu::BlendEquation::kOverlay);
static_assert(5 == kDarken_GrBlendEquation); static_assert(5 == (int)skgpu::BlendEquation::kDarken);
static_assert(6 == kLighten_GrBlendEquation); static_assert(6 == (int)skgpu::BlendEquation::kLighten);
static_assert(7 == kColorDodge_GrBlendEquation); static_assert(7 == (int)skgpu::BlendEquation::kColorDodge);
static_assert(8 == kColorBurn_GrBlendEquation); static_assert(8 == (int)skgpu::BlendEquation::kColorBurn);
static_assert(9 == kHardLight_GrBlendEquation); static_assert(9 == (int)skgpu::BlendEquation::kHardLight);
static_assert(10 == kSoftLight_GrBlendEquation); static_assert(10 == (int)skgpu::BlendEquation::kSoftLight);
static_assert(11 == kDifference_GrBlendEquation); static_assert(11 == (int)skgpu::BlendEquation::kDifference);
static_assert(12 == kExclusion_GrBlendEquation); static_assert(12 == (int)skgpu::BlendEquation::kExclusion);
static_assert(13 == kMultiply_GrBlendEquation); static_assert(13 == (int)skgpu::BlendEquation::kMultiply);
static_assert(14 == kHSLHue_GrBlendEquation); static_assert(14 == (int)skgpu::BlendEquation::kHSLHue);
static_assert(15 == kHSLSaturation_GrBlendEquation); static_assert(15 == (int)skgpu::BlendEquation::kHSLSaturation);
static_assert(16 == kHSLColor_GrBlendEquation); static_assert(16 == (int)skgpu::BlendEquation::kHSLColor);
static_assert(17 == kHSLLuminosity_GrBlendEquation); static_assert(17 == (int)skgpu::BlendEquation::kHSLLuminosity);
static_assert(SK_ARRAY_COUNT(gXfermodeEquation2Blend) == kGrBlendEquationCnt); static_assert(SK_ARRAY_COUNT(gXfermodeEquation2Blend) == skgpu::kBlendEquationCnt);
static const GrGLenum gXfermodeCoeff2Blend[] = { static const GrGLenum gXfermodeCoeff2Blend[] = {
GR_GL_ZERO, GR_GL_ZERO,
@ -2552,19 +2552,19 @@ void GrGLGpu::flushBlendAndColorWrite(
// We need to work around a driver bug by using a blend state that preserves the dst color, // We need to work around a driver bug by using a blend state that preserves the dst color,
// rather than disabling color writes. // rather than disabling color writes.
GrXferProcessor::BlendInfo preserveDstBlend; GrXferProcessor::BlendInfo preserveDstBlend;
preserveDstBlend.fSrcBlend = kZero_GrBlendCoeff; preserveDstBlend.fSrcBlend = skgpu::BlendCoeff::kZero;
preserveDstBlend.fDstBlend = kOne_GrBlendCoeff; preserveDstBlend.fDstBlend = skgpu::BlendCoeff::kOne;
this->flushBlendAndColorWrite(preserveDstBlend, swizzle); this->flushBlendAndColorWrite(preserveDstBlend, swizzle);
return; return;
} }
GrBlendEquation equation = blendInfo.fEquation; skgpu::BlendEquation equation = blendInfo.fEquation;
GrBlendCoeff srcCoeff = blendInfo.fSrcBlend; skgpu::BlendCoeff srcCoeff = blendInfo.fSrcBlend;
GrBlendCoeff dstCoeff = blendInfo.fDstBlend; skgpu::BlendCoeff dstCoeff = blendInfo.fDstBlend;
// Any optimization to disable blending should have already been applied and // Any optimization to disable blending should have already been applied and
// tweaked the equation to "add" or "subtract", and the coeffs to (1, 0). // tweaked the equation to "add" or "subtract", and the coeffs to (1, 0).
bool blendOff = GrBlendShouldDisable(equation, srcCoeff, dstCoeff) || bool blendOff = skgpu::BlendShouldDisable(equation, srcCoeff, dstCoeff) ||
!blendInfo.fWriteColor; !blendInfo.fWriteColor;
if (blendOff) { if (blendOff) {
@ -2574,12 +2574,12 @@ void GrGLGpu::flushBlendAndColorWrite(
// Workaround for the ARM KHR_blend_equation_advanced disable flags issue // Workaround for the ARM KHR_blend_equation_advanced disable flags issue
// https://code.google.com/p/skia/issues/detail?id=3943 // https://code.google.com/p/skia/issues/detail?id=3943
if (this->ctxInfo().vendor() == GrGLVendor::kARM && if (this->ctxInfo().vendor() == GrGLVendor::kARM &&
GrBlendEquationIsAdvanced(fHWBlendState.fEquation)) { skgpu::BlendEquationIsAdvanced(fHWBlendState.fEquation)) {
SkASSERT(this->caps()->advancedBlendEquationSupport()); SkASSERT(this->caps()->advancedBlendEquationSupport());
// Set to any basic blending equation. // Set to any basic blending equation.
GrBlendEquation blend_equation = kAdd_GrBlendEquation; skgpu::BlendEquation blendEquation = skgpu::BlendEquation::kAdd;
GL_CALL(BlendEquation(gXfermodeEquation2Blend[blend_equation])); GL_CALL(BlendEquation(gXfermodeEquation2Blend[(int)blendEquation]));
fHWBlendState.fEquation = blend_equation; fHWBlendState.fEquation = blendEquation;
} }
// Workaround for Adreno 5xx BlendFunc bug. See crbug.com/1241134. // Workaround for Adreno 5xx BlendFunc bug. See crbug.com/1241134.
@ -2587,14 +2587,14 @@ void GrGLGpu::flushBlendAndColorWrite(
// reset our gl state and thus we will have forgotten if the previous use was a coeff // reset our gl state and thus we will have forgotten if the previous use was a coeff
// that referenced src2. // that referenced src2.
if (this->glCaps().mustResetBlendFuncBetweenDualSourceAndDisable() && if (this->glCaps().mustResetBlendFuncBetweenDualSourceAndDisable() &&
(GrBlendCoeffRefsSrc2(fHWBlendState.fSrcCoeff) || (skgpu::BlendCoeffRefsSrc2(fHWBlendState.fSrcCoeff) ||
GrBlendCoeffRefsSrc2(fHWBlendState.fDstCoeff) || skgpu::BlendCoeffRefsSrc2(fHWBlendState.fDstCoeff) ||
fHWBlendState.fSrcCoeff == kIllegal_GrBlendCoeff || fHWBlendState.fSrcCoeff == skgpu::BlendCoeff::kIllegal ||
fHWBlendState.fDstCoeff == kIllegal_GrBlendCoeff)) { fHWBlendState.fDstCoeff == skgpu::BlendCoeff::kIllegal)) {
// We just reset the blend func to anything that doesn't reference src2 // We just reset the blend func to anything that doesn't reference src2
GL_CALL(BlendFunc(GR_GL_ONE, GR_GL_ZERO)); GL_CALL(BlendFunc(GR_GL_ONE, GR_GL_ZERO));
fHWBlendState.fSrcCoeff = kOne_GrBlendCoeff; fHWBlendState.fSrcCoeff = skgpu::BlendCoeff::kOne;
fHWBlendState.fDstCoeff = kZero_GrBlendCoeff; fHWBlendState.fDstCoeff = skgpu::BlendCoeff::kZero;
} }
fHWBlendState.fEnabled = kNo_TriState; fHWBlendState.fEnabled = kNo_TriState;
@ -2607,24 +2607,24 @@ void GrGLGpu::flushBlendAndColorWrite(
} }
if (fHWBlendState.fEquation != equation) { if (fHWBlendState.fEquation != equation) {
GL_CALL(BlendEquation(gXfermodeEquation2Blend[equation])); GL_CALL(BlendEquation(gXfermodeEquation2Blend[(int)equation]));
fHWBlendState.fEquation = equation; fHWBlendState.fEquation = equation;
} }
if (GrBlendEquationIsAdvanced(equation)) { if (skgpu::BlendEquationIsAdvanced(equation)) {
SkASSERT(this->caps()->advancedBlendEquationSupport()); SkASSERT(this->caps()->advancedBlendEquationSupport());
// Advanced equations have no other blend state. // Advanced equations have no other blend state.
return; return;
} }
if (fHWBlendState.fSrcCoeff != srcCoeff || fHWBlendState.fDstCoeff != dstCoeff) { if (fHWBlendState.fSrcCoeff != srcCoeff || fHWBlendState.fDstCoeff != dstCoeff) {
GL_CALL(BlendFunc(gXfermodeCoeff2Blend[srcCoeff], GL_CALL(BlendFunc(gXfermodeCoeff2Blend[(int)srcCoeff],
gXfermodeCoeff2Blend[dstCoeff])); gXfermodeCoeff2Blend[(int)dstCoeff]));
fHWBlendState.fSrcCoeff = srcCoeff; fHWBlendState.fSrcCoeff = srcCoeff;
fHWBlendState.fDstCoeff = dstCoeff; fHWBlendState.fDstCoeff = dstCoeff;
} }
if (GrBlendCoeffRefsConstant(srcCoeff) || GrBlendCoeffRefsConstant(dstCoeff)) { if (skgpu::BlendCoeffRefsConstant(srcCoeff) || skgpu::BlendCoeffRefsConstant(dstCoeff)) {
SkPMColor4f blendConst = swizzle.applyTo(blendInfo.fBlendConstant); SkPMColor4f blendConst = swizzle.applyTo(blendInfo.fBlendConstant);
if (!fHWBlendState.fConstColorValid || fHWBlendState.fConstColor != blendConst) { if (!fHWBlendState.fConstColorValid || fHWBlendState.fConstColor != blendConst) {
GL_CALL(BlendColor(blendConst.fR, blendConst.fG, blendConst.fB, blendConst.fA)); GL_CALL(BlendColor(blendConst.fR, blendConst.fG, blendConst.fB, blendConst.fA));

View File

@ -705,17 +705,17 @@ private:
void setNeedsFlush() { fNeedsGLFlush = true; } void setNeedsFlush() { fNeedsGLFlush = true; }
struct { struct {
GrBlendEquation fEquation; skgpu::BlendEquation fEquation;
GrBlendCoeff fSrcCoeff; skgpu::BlendCoeff fSrcCoeff;
GrBlendCoeff fDstCoeff; skgpu::BlendCoeff fDstCoeff;
SkPMColor4f fConstColor; SkPMColor4f fConstColor;
bool fConstColorValid; bool fConstColorValid;
TriState fEnabled; TriState fEnabled;
void invalidate() { void invalidate() {
fEquation = kIllegal_GrBlendEquation; fEquation = skgpu::BlendEquation::kIllegal;
fSrcCoeff = kIllegal_GrBlendCoeff; fSrcCoeff = skgpu::BlendCoeff::kIllegal;
fDstCoeff = kIllegal_GrBlendCoeff; fDstCoeff = skgpu::BlendCoeff::kIllegal;
fConstColorValid = false; fConstColorValid = false;
fEnabled = kUnknown_TriState; fEnabled = kUnknown_TriState;
} }

View File

@ -38,8 +38,9 @@ const char* GrGLSLFragmentShaderBuilder::dstColor() {
return kDstColorName; return kDstColorName;
} }
void GrGLSLFragmentShaderBuilder::enableAdvancedBlendEquationIfNeeded(GrBlendEquation equation) { void GrGLSLFragmentShaderBuilder::enableAdvancedBlendEquationIfNeeded(
SkASSERT(GrBlendEquationIsAdvanced(equation)); skgpu::BlendEquation equation) {
SkASSERT(skgpu::BlendEquationIsAdvanced(equation));
if (fProgramBuilder->shaderCaps()->mustEnableAdvBlendEqs()) { if (fProgramBuilder->shaderCaps()->mustEnableAdvBlendEqs()) {
this->addFeature(1 << kBlendEquationAdvanced_GLSLPrivateFeature, this->addFeature(1 << kBlendEquationAdvanced_GLSLPrivateFeature,

View File

@ -8,7 +8,7 @@
#ifndef GrGLSLFragmentShaderBuilder_DEFINED #ifndef GrGLSLFragmentShaderBuilder_DEFINED
#define GrGLSLFragmentShaderBuilder_DEFINED #define GrGLSLFragmentShaderBuilder_DEFINED
#include "src/gpu/GrBlend.h" #include "src/gpu/Blend.h"
#include "src/gpu/GrFragmentProcessor.h" #include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrProcessor.h" #include "src/gpu/GrProcessor.h"
#include "src/gpu/glsl/GrGLSLShaderBuilder.h" #include "src/gpu/glsl/GrGLSLShaderBuilder.h"
@ -74,7 +74,7 @@ public:
/** Adds any necessary layout qualifiers in order to legalize the supplied blend equation with /** Adds any necessary layout qualifiers in order to legalize the supplied blend equation with
this shader. It is only legal to call this method with an advanced blend equation, and only this shader. It is only legal to call this method with an advanced blend equation, and only
if these equations are supported. */ if these equations are supported. */
virtual void enableAdvancedBlendEquationIfNeeded(GrBlendEquation) = 0; virtual void enableAdvancedBlendEquationIfNeeded(skgpu::BlendEquation) = 0;
}; };
/* /*
@ -93,7 +93,7 @@ public:
// GrGLSLXPFragmentBuilder interface. // GrGLSLXPFragmentBuilder interface.
bool hasCustomColorOutput() const override { return SkToBool(fCustomColorOutput); } bool hasCustomColorOutput() const override { return SkToBool(fCustomColorOutput); }
bool hasSecondaryOutput() const override { return fHasSecondaryOutput; } bool hasSecondaryOutput() const override { return fHasSecondaryOutput; }
void enableAdvancedBlendEquationIfNeeded(GrBlendEquation) override; void enableAdvancedBlendEquationIfNeeded(skgpu::BlendEquation) override;
private: private:
// Private public interface, used by GrGLProgramBuilder to build a fragment shader // Private public interface, used by GrGLProgramBuilder to build a fragment shader

View File

@ -165,9 +165,9 @@ void GrMtlPipelineState::setBlendConstants(GrMtlRenderCommandEncoder* renderCmdE
} }
const GrXferProcessor::BlendInfo& blendInfo = xferProcessor.getBlendInfo(); const GrXferProcessor::BlendInfo& blendInfo = xferProcessor.getBlendInfo();
GrBlendCoeff srcCoeff = blendInfo.fSrcBlend; skgpu::BlendCoeff srcCoeff = blendInfo.fSrcBlend;
GrBlendCoeff dstCoeff = blendInfo.fDstBlend; skgpu::BlendCoeff dstCoeff = blendInfo.fDstBlend;
if (GrBlendCoeffRefsConstant(srcCoeff) || GrBlendCoeffRefsConstant(dstCoeff)) { if (skgpu::BlendCoeffRefsConstant(srcCoeff) || skgpu::BlendCoeffRefsConstant(dstCoeff)) {
// Swizzle the blend to match what the shader will output. // Swizzle the blend to match what the shader will output.
SkPMColor4f blendConst = swizzle.applyTo(blendInfo.fBlendConstant); SkPMColor4f blendConst = swizzle.applyTo(blendInfo.fBlendConstant);

View File

@ -259,76 +259,76 @@ static MTLVertexDescriptor* create_vertex_descriptor(const GrGeometryProcessor&
return vertexDescriptor; return vertexDescriptor;
} }
static MTLBlendFactor blend_coeff_to_mtl_blend(GrBlendCoeff coeff) { static MTLBlendFactor blend_coeff_to_mtl_blend(skgpu::BlendCoeff coeff) {
switch (coeff) { switch (coeff) {
case kZero_GrBlendCoeff: case skgpu::BlendCoeff::kZero:
return MTLBlendFactorZero; return MTLBlendFactorZero;
case kOne_GrBlendCoeff: case skgpu::BlendCoeff::kOne:
return MTLBlendFactorOne; return MTLBlendFactorOne;
case kSC_GrBlendCoeff: case skgpu::BlendCoeff::kSC:
return MTLBlendFactorSourceColor; return MTLBlendFactorSourceColor;
case kISC_GrBlendCoeff: case skgpu::BlendCoeff::kISC:
return MTLBlendFactorOneMinusSourceColor; return MTLBlendFactorOneMinusSourceColor;
case kDC_GrBlendCoeff: case skgpu::BlendCoeff::kDC:
return MTLBlendFactorDestinationColor; return MTLBlendFactorDestinationColor;
case kIDC_GrBlendCoeff: case skgpu::BlendCoeff::kIDC:
return MTLBlendFactorOneMinusDestinationColor; return MTLBlendFactorOneMinusDestinationColor;
case kSA_GrBlendCoeff: case skgpu::BlendCoeff::kSA:
return MTLBlendFactorSourceAlpha; return MTLBlendFactorSourceAlpha;
case kISA_GrBlendCoeff: case skgpu::BlendCoeff::kISA:
return MTLBlendFactorOneMinusSourceAlpha; return MTLBlendFactorOneMinusSourceAlpha;
case kDA_GrBlendCoeff: case skgpu::BlendCoeff::kDA:
return MTLBlendFactorDestinationAlpha; return MTLBlendFactorDestinationAlpha;
case kIDA_GrBlendCoeff: case skgpu::BlendCoeff::kIDA:
return MTLBlendFactorOneMinusDestinationAlpha; return MTLBlendFactorOneMinusDestinationAlpha;
case kConstC_GrBlendCoeff: case skgpu::BlendCoeff::kConstC:
return MTLBlendFactorBlendColor; return MTLBlendFactorBlendColor;
case kIConstC_GrBlendCoeff: case skgpu::BlendCoeff::kIConstC:
return MTLBlendFactorOneMinusBlendColor; return MTLBlendFactorOneMinusBlendColor;
case kS2C_GrBlendCoeff: case skgpu::BlendCoeff::kS2C:
if (@available(macOS 10.12, iOS 11.0, *)) { if (@available(macOS 10.12, iOS 11.0, *)) {
return MTLBlendFactorSource1Color; return MTLBlendFactorSource1Color;
} else { } else {
return MTLBlendFactorZero; return MTLBlendFactorZero;
} }
case kIS2C_GrBlendCoeff: case skgpu::BlendCoeff::kIS2C:
if (@available(macOS 10.12, iOS 11.0, *)) { if (@available(macOS 10.12, iOS 11.0, *)) {
return MTLBlendFactorOneMinusSource1Color; return MTLBlendFactorOneMinusSource1Color;
} else { } else {
return MTLBlendFactorZero; return MTLBlendFactorZero;
} }
case kS2A_GrBlendCoeff: case skgpu::BlendCoeff::kS2A:
if (@available(macOS 10.12, iOS 11.0, *)) { if (@available(macOS 10.12, iOS 11.0, *)) {
return MTLBlendFactorSource1Alpha; return MTLBlendFactorSource1Alpha;
} else { } else {
return MTLBlendFactorZero; return MTLBlendFactorZero;
} }
case kIS2A_GrBlendCoeff: case skgpu::BlendCoeff::kIS2A:
if (@available(macOS 10.12, iOS 11.0, *)) { if (@available(macOS 10.12, iOS 11.0, *)) {
return MTLBlendFactorOneMinusSource1Alpha; return MTLBlendFactorOneMinusSource1Alpha;
} else { } else {
return MTLBlendFactorZero; return MTLBlendFactorZero;
} }
case kIllegal_GrBlendCoeff: case skgpu::BlendCoeff::kIllegal:
return MTLBlendFactorZero; return MTLBlendFactorZero;
} }
SK_ABORT("Unknown blend coefficient"); SK_ABORT("Unknown blend coefficient");
} }
static MTLBlendOperation blend_equation_to_mtl_blend_op(GrBlendEquation equation) { static MTLBlendOperation blend_equation_to_mtl_blend_op(skgpu::BlendEquation equation) {
static const MTLBlendOperation gTable[] = { static const MTLBlendOperation gTable[] = {
MTLBlendOperationAdd, // kAdd_GrBlendEquation MTLBlendOperationAdd, // skgpu::BlendEquation::kAdd
MTLBlendOperationSubtract, // kSubtract_GrBlendEquation MTLBlendOperationSubtract, // skgpu::BlendEquation::kSubtract
MTLBlendOperationReverseSubtract, // kReverseSubtract_GrBlendEquation MTLBlendOperationReverseSubtract, // skgpu::BlendEquation::kReverseSubtract
}; };
static_assert(SK_ARRAY_COUNT(gTable) == kFirstAdvancedGrBlendEquation); static_assert(SK_ARRAY_COUNT(gTable) == (int)skgpu::BlendEquation::kFirstAdvanced);
static_assert(0 == kAdd_GrBlendEquation); static_assert(0 == (int)skgpu::BlendEquation::kAdd);
static_assert(1 == kSubtract_GrBlendEquation); static_assert(1 == (int)skgpu::BlendEquation::kSubtract);
static_assert(2 == kReverseSubtract_GrBlendEquation); static_assert(2 == (int)skgpu::BlendEquation::kReverseSubtract);
SkASSERT((unsigned)equation < kGrBlendEquationCnt); SkASSERT((unsigned)equation < skgpu::kBlendEquationCnt);
return gTable[equation]; return gTable[(int)equation];
} }
static MTLRenderPipelineColorAttachmentDescriptor* create_color_attachment( static MTLRenderPipelineColorAttachmentDescriptor* create_color_attachment(
@ -344,10 +344,10 @@ static MTLRenderPipelineColorAttachmentDescriptor* create_color_attachment(
// blending // blending
const GrXferProcessor::BlendInfo& blendInfo = pipeline.getXferProcessor().getBlendInfo(); const GrXferProcessor::BlendInfo& blendInfo = pipeline.getXferProcessor().getBlendInfo();
GrBlendEquation equation = blendInfo.fEquation; skgpu::BlendEquation equation = blendInfo.fEquation;
GrBlendCoeff srcCoeff = blendInfo.fSrcBlend; skgpu::BlendCoeff srcCoeff = blendInfo.fSrcBlend;
GrBlendCoeff dstCoeff = blendInfo.fDstBlend; skgpu::BlendCoeff dstCoeff = blendInfo.fDstBlend;
bool blendOn = !GrBlendShouldDisable(equation, srcCoeff, dstCoeff); bool blendOn = !skgpu::BlendShouldDisable(equation, srcCoeff, dstCoeff);
mtlColorAttachment.blendingEnabled = blendOn; mtlColorAttachment.blendingEnabled = blendOn;
if (writer) { if (writer) {

View File

@ -289,47 +289,47 @@ static void setup_multisample_state(int numSamples,
multisampleInfo->alphaToOneEnable = VK_FALSE; multisampleInfo->alphaToOneEnable = VK_FALSE;
} }
static VkBlendFactor blend_coeff_to_vk_blend(GrBlendCoeff coeff) { static VkBlendFactor blend_coeff_to_vk_blend(skgpu::BlendCoeff coeff) {
switch (coeff) { switch (coeff) {
case kZero_GrBlendCoeff: case skgpu::BlendCoeff::kZero:
return VK_BLEND_FACTOR_ZERO; return VK_BLEND_FACTOR_ZERO;
case kOne_GrBlendCoeff: case skgpu::BlendCoeff::kOne:
return VK_BLEND_FACTOR_ONE; return VK_BLEND_FACTOR_ONE;
case kSC_GrBlendCoeff: case skgpu::BlendCoeff::kSC:
return VK_BLEND_FACTOR_SRC_COLOR; return VK_BLEND_FACTOR_SRC_COLOR;
case kISC_GrBlendCoeff: case skgpu::BlendCoeff::kISC:
return VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR; return VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR;
case kDC_GrBlendCoeff: case skgpu::BlendCoeff::kDC:
return VK_BLEND_FACTOR_DST_COLOR; return VK_BLEND_FACTOR_DST_COLOR;
case kIDC_GrBlendCoeff: case skgpu::BlendCoeff::kIDC:
return VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR; return VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR;
case kSA_GrBlendCoeff: case skgpu::BlendCoeff::kSA:
return VK_BLEND_FACTOR_SRC_ALPHA; return VK_BLEND_FACTOR_SRC_ALPHA;
case kISA_GrBlendCoeff: case skgpu::BlendCoeff::kISA:
return VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; return VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
case kDA_GrBlendCoeff: case skgpu::BlendCoeff::kDA:
return VK_BLEND_FACTOR_DST_ALPHA; return VK_BLEND_FACTOR_DST_ALPHA;
case kIDA_GrBlendCoeff: case skgpu::BlendCoeff::kIDA:
return VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA; return VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA;
case kConstC_GrBlendCoeff: case skgpu::BlendCoeff::kConstC:
return VK_BLEND_FACTOR_CONSTANT_COLOR; return VK_BLEND_FACTOR_CONSTANT_COLOR;
case kIConstC_GrBlendCoeff: case skgpu::BlendCoeff::kIConstC:
return VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR; return VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR;
case kS2C_GrBlendCoeff: case skgpu::BlendCoeff::kS2C:
return VK_BLEND_FACTOR_SRC1_COLOR; return VK_BLEND_FACTOR_SRC1_COLOR;
case kIS2C_GrBlendCoeff: case skgpu::BlendCoeff::kIS2C:
return VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR; return VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR;
case kS2A_GrBlendCoeff: case skgpu::BlendCoeff::kS2A:
return VK_BLEND_FACTOR_SRC1_ALPHA; return VK_BLEND_FACTOR_SRC1_ALPHA;
case kIS2A_GrBlendCoeff: case skgpu::BlendCoeff::kIS2A:
return VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA; return VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA;
case kIllegal_GrBlendCoeff: case skgpu::BlendCoeff::kIllegal:
return VK_BLEND_FACTOR_ZERO; return VK_BLEND_FACTOR_ZERO;
} }
SkUNREACHABLE; SkUNREACHABLE;
} }
static VkBlendOp blend_equation_to_vk_blend_op(GrBlendEquation equation) { static VkBlendOp blend_equation_to_vk_blend_op(skgpu::BlendEquation equation) {
static const VkBlendOp gTable[] = { static const VkBlendOp gTable[] = {
// Basic blend ops // Basic blend ops
VK_BLEND_OP_ADD, VK_BLEND_OP_ADD,
@ -356,37 +356,37 @@ static VkBlendOp blend_equation_to_vk_blend_op(GrBlendEquation equation) {
// Illegal. // Illegal.
VK_BLEND_OP_ADD, VK_BLEND_OP_ADD,
}; };
static_assert(0 == kAdd_GrBlendEquation); static_assert(0 == (int)skgpu::BlendEquation::kAdd);
static_assert(1 == kSubtract_GrBlendEquation); static_assert(1 == (int)skgpu::BlendEquation::kSubtract);
static_assert(2 == kReverseSubtract_GrBlendEquation); static_assert(2 == (int)skgpu::BlendEquation::kReverseSubtract);
static_assert(3 == kScreen_GrBlendEquation); static_assert(3 == (int)skgpu::BlendEquation::kScreen);
static_assert(4 == kOverlay_GrBlendEquation); static_assert(4 == (int)skgpu::BlendEquation::kOverlay);
static_assert(5 == kDarken_GrBlendEquation); static_assert(5 == (int)skgpu::BlendEquation::kDarken);
static_assert(6 == kLighten_GrBlendEquation); static_assert(6 == (int)skgpu::BlendEquation::kLighten);
static_assert(7 == kColorDodge_GrBlendEquation); static_assert(7 == (int)skgpu::BlendEquation::kColorDodge);
static_assert(8 == kColorBurn_GrBlendEquation); static_assert(8 == (int)skgpu::BlendEquation::kColorBurn);
static_assert(9 == kHardLight_GrBlendEquation); static_assert(9 == (int)skgpu::BlendEquation::kHardLight);
static_assert(10 == kSoftLight_GrBlendEquation); static_assert(10 == (int)skgpu::BlendEquation::kSoftLight);
static_assert(11 == kDifference_GrBlendEquation); static_assert(11 == (int)skgpu::BlendEquation::kDifference);
static_assert(12 == kExclusion_GrBlendEquation); static_assert(12 == (int)skgpu::BlendEquation::kExclusion);
static_assert(13 == kMultiply_GrBlendEquation); static_assert(13 == (int)skgpu::BlendEquation::kMultiply);
static_assert(14 == kHSLHue_GrBlendEquation); static_assert(14 == (int)skgpu::BlendEquation::kHSLHue);
static_assert(15 == kHSLSaturation_GrBlendEquation); static_assert(15 == (int)skgpu::BlendEquation::kHSLSaturation);
static_assert(16 == kHSLColor_GrBlendEquation); static_assert(16 == (int)skgpu::BlendEquation::kHSLColor);
static_assert(17 == kHSLLuminosity_GrBlendEquation); static_assert(17 == (int)skgpu::BlendEquation::kHSLLuminosity);
static_assert(SK_ARRAY_COUNT(gTable) == kGrBlendEquationCnt); static_assert(SK_ARRAY_COUNT(gTable) == skgpu::kBlendEquationCnt);
SkASSERT((unsigned)equation < kGrBlendEquationCnt); SkASSERT((unsigned)equation < skgpu::kBlendEquationCnt);
return gTable[equation]; return gTable[(int)equation];
} }
static void setup_color_blend_state(const GrXferProcessor::BlendInfo& blendInfo, static void setup_color_blend_state(const GrXferProcessor::BlendInfo& blendInfo,
VkPipelineColorBlendStateCreateInfo* colorBlendInfo, VkPipelineColorBlendStateCreateInfo* colorBlendInfo,
VkPipelineColorBlendAttachmentState* attachmentState) { VkPipelineColorBlendAttachmentState* attachmentState) {
GrBlendEquation equation = blendInfo.fEquation; skgpu::BlendEquation equation = blendInfo.fEquation;
GrBlendCoeff srcCoeff = blendInfo.fSrcBlend; skgpu::BlendCoeff srcCoeff = blendInfo.fSrcBlend;
GrBlendCoeff dstCoeff = blendInfo.fDstBlend; skgpu::BlendCoeff dstCoeff = blendInfo.fDstBlend;
bool blendOff = GrBlendShouldDisable(equation, srcCoeff, dstCoeff); bool blendOff = skgpu::BlendShouldDisable(equation, srcCoeff, dstCoeff);
memset(attachmentState, 0, sizeof(VkPipelineColorBlendAttachmentState)); memset(attachmentState, 0, sizeof(VkPipelineColorBlendAttachmentState));
attachmentState->blendEnable = !blendOff; attachmentState->blendEnable = !blendOff;
@ -648,10 +648,10 @@ void GrVkPipeline::SetDynamicBlendConstantState(GrVkGpu* gpu,
const skgpu::Swizzle& swizzle, const skgpu::Swizzle& swizzle,
const GrXferProcessor& xferProcessor) { const GrXferProcessor& xferProcessor) {
const GrXferProcessor::BlendInfo& blendInfo = xferProcessor.getBlendInfo(); const GrXferProcessor::BlendInfo& blendInfo = xferProcessor.getBlendInfo();
GrBlendCoeff srcCoeff = blendInfo.fSrcBlend; skgpu::BlendCoeff srcCoeff = blendInfo.fSrcBlend;
GrBlendCoeff dstCoeff = blendInfo.fDstBlend; skgpu::BlendCoeff dstCoeff = blendInfo.fDstBlend;
float floatColors[4]; float floatColors[4];
if (GrBlendCoeffRefsConstant(srcCoeff) || GrBlendCoeffRefsConstant(dstCoeff)) { if (skgpu::BlendCoeffRefsConstant(srcCoeff) || skgpu::BlendCoeffRefsConstant(dstCoeff)) {
// Swizzle the blend to match what the shader will output. // Swizzle the blend to match what the shader will output.
SkPMColor4f blendConst = swizzle.applyTo(blendInfo.fBlendConstant); SkPMColor4f blendConst = swizzle.applyTo(blendInfo.fBlendConstant);
floatColors[0] = blendConst.fR; floatColors[0] = blendConst.fR;

View File

@ -9,7 +9,7 @@
#include "include/gpu/GrDirectContext.h" #include "include/gpu/GrDirectContext.h"
#include "include/private/GrTypesPriv.h" #include "include/private/GrTypesPriv.h"
#include "include/private/SkColorData.h" #include "include/private/SkColorData.h"
#include "src/gpu/GrBlend.h" #include "src/gpu/Blend.h"
#include "src/gpu/GrCaps.h" #include "src/gpu/GrCaps.h"
#include "src/gpu/GrDirectContextPriv.h" #include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrPaint.h" #include "src/gpu/GrPaint.h"
@ -30,8 +30,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(AdvancedBlendTest, reporter, ctxInfo) {
for (int mode = (int)SkBlendMode::kLastMode; mode > (int)SkBlendMode::kLastCoeffMode; --mode) { for (int mode = (int)SkBlendMode::kLastMode; mode > (int)SkBlendMode::kLastCoeffMode; --mode) {
const SkBlendMode blendMode = (SkBlendMode)mode; const SkBlendMode blendMode = (SkBlendMode)mode;
const GrBlendEquation blendEquation = const skgpu::BlendEquation blendEquation = (skgpu::BlendEquation)(mode +
(GrBlendEquation)(mode + (kOverlay_GrBlendEquation - (int)SkBlendMode::kOverlay)); ((int)skgpu::BlendEquation::kOverlay - (int)SkBlendMode::kOverlay));
const GrXPFactory* xpf = GrCustomXfermode::Get(blendMode); const GrXPFactory* xpf = GrCustomXfermode::Get(blendMode);
GrXPFactory::AnalysisProperties xpfAnalysis = GrXPFactory::AnalysisProperties xpfAnalysis =

View File

@ -104,7 +104,8 @@ public:
TEST_ASSERT(!xp->willReadDstColor() || TEST_ASSERT(!xp->willReadDstColor() ||
(isLCD && (SkBlendMode::kSrcOver != xfermode || (isLCD && (SkBlendMode::kSrcOver != xfermode ||
!inputColor.isOpaque()))); !inputColor.isOpaque())));
TEST_ASSERT(xp->hasSecondaryOutput() == GrBlendCoeffRefsSrc2(fBlendInfo.fDstBlend)); TEST_ASSERT(xp->hasSecondaryOutput() ==
skgpu::BlendCoeffRefsSrc2(fBlendInfo.fDstBlend));
} }
bool fCompatibleWithCoverageAsAlpha; bool fCompatibleWithCoverageAsAlpha;
@ -134,9 +135,9 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrc: case SkBlendMode::kSrc:
@ -145,9 +146,9 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDst: case SkBlendMode::kDst:
@ -156,9 +157,9 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcOver: case SkBlendMode::kSrcOver:
@ -167,9 +168,9 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kSAModulate_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kSAModulate_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kIS2C == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstOver: case SkBlendMode::kDstOver:
@ -178,9 +179,9 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcIn: case SkBlendMode::kSrcIn:
@ -189,9 +190,9 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstIn: case SkBlendMode::kDstIn:
@ -200,9 +201,9 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcOut: case SkBlendMode::kSrcOut:
@ -211,9 +212,9 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstOut: case SkBlendMode::kDstOut:
@ -222,9 +223,9 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcATop: case SkBlendMode::kSrcATop:
@ -233,9 +234,9 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstATop: case SkBlendMode::kDstATop:
@ -244,9 +245,9 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kXor: case SkBlendMode::kXor:
@ -255,9 +256,9 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kPlus: case SkBlendMode::kPlus:
@ -266,9 +267,9 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kModulate: case SkBlendMode::kModulate:
@ -277,9 +278,9 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kScreen: case SkBlendMode::kScreen:
@ -288,9 +289,9 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kInvalid_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
default: default:
@ -313,9 +314,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kReverseSubtract == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kDC == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrc: case SkBlendMode::kSrc:
@ -324,9 +325,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kIS2A_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kIS2A == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDst: case SkBlendMode::kDst:
@ -335,9 +336,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); TEST_ASSERT(!xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcOver: case SkBlendMode::kSrcOver:
@ -346,9 +347,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstOver: case SkBlendMode::kDstOver:
@ -357,9 +358,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcIn: case SkBlendMode::kSrcIn:
@ -368,9 +369,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kIS2A_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kIS2A == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstIn: case SkBlendMode::kDstIn:
@ -379,9 +380,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kISAModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kISAModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kReverseSubtract == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kDC == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcOut: case SkBlendMode::kSrcOut:
@ -390,9 +391,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kCoverage_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kIS2A_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kIS2A == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstOut: case SkBlendMode::kDstOut:
@ -401,9 +402,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcATop: case SkBlendMode::kSrcATop:
@ -412,9 +413,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstATop: case SkBlendMode::kDstATop:
@ -423,9 +424,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kISAModulate_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kISAModulate_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kIS2C_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kIS2C == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kXor: case SkBlendMode::kXor:
@ -434,9 +435,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kPlus: case SkBlendMode::kPlus:
@ -445,9 +446,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kModulate: case SkBlendMode::kModulate:
@ -456,9 +457,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kReverseSubtract == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kDC == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kScreen: case SkBlendMode::kScreen:
@ -467,9 +468,9 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISC == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
default: default:
@ -494,9 +495,9 @@ static void test_color_not_opaque_no_coverage(skiatest::Reporter* reporter, cons
TEST_ASSERT(xpi.fUnaffectedByDstValue); TEST_ASSERT(xpi.fUnaffectedByDstValue);
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrc: case SkBlendMode::kSrc:
@ -505,9 +506,9 @@ static void test_color_not_opaque_no_coverage(skiatest::Reporter* reporter, cons
TEST_ASSERT(xpi.fUnaffectedByDstValue); TEST_ASSERT(xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDst: case SkBlendMode::kDst:
@ -516,9 +517,9 @@ static void test_color_not_opaque_no_coverage(skiatest::Reporter* reporter, cons
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); TEST_ASSERT(!xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcOver: case SkBlendMode::kSrcOver:
@ -527,9 +528,9 @@ static void test_color_not_opaque_no_coverage(skiatest::Reporter* reporter, cons
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstOver: case SkBlendMode::kDstOver:
@ -538,9 +539,9 @@ static void test_color_not_opaque_no_coverage(skiatest::Reporter* reporter, cons
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcIn: case SkBlendMode::kSrcIn:
@ -549,9 +550,9 @@ static void test_color_not_opaque_no_coverage(skiatest::Reporter* reporter, cons
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstIn: case SkBlendMode::kDstIn:
@ -560,9 +561,9 @@ static void test_color_not_opaque_no_coverage(skiatest::Reporter* reporter, cons
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kSA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kSA == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcOut: case SkBlendMode::kSrcOut:
@ -571,9 +572,9 @@ static void test_color_not_opaque_no_coverage(skiatest::Reporter* reporter, cons
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstOut: case SkBlendMode::kDstOut:
@ -582,9 +583,9 @@ static void test_color_not_opaque_no_coverage(skiatest::Reporter* reporter, cons
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcATop: case SkBlendMode::kSrcATop:
@ -593,9 +594,9 @@ static void test_color_not_opaque_no_coverage(skiatest::Reporter* reporter, cons
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstATop: case SkBlendMode::kDstATop:
@ -604,9 +605,9 @@ static void test_color_not_opaque_no_coverage(skiatest::Reporter* reporter, cons
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kSA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kSA == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kXor: case SkBlendMode::kXor:
@ -615,9 +616,9 @@ static void test_color_not_opaque_no_coverage(skiatest::Reporter* reporter, cons
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kPlus: case SkBlendMode::kPlus:
@ -626,9 +627,9 @@ static void test_color_not_opaque_no_coverage(skiatest::Reporter* reporter, cons
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kModulate: case SkBlendMode::kModulate:
@ -637,9 +638,9 @@ static void test_color_not_opaque_no_coverage(skiatest::Reporter* reporter, cons
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kSC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kSC == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kScreen: case SkBlendMode::kScreen:
@ -648,9 +649,9 @@ static void test_color_not_opaque_no_coverage(skiatest::Reporter* reporter, cons
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISC == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
default: default:
@ -674,9 +675,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kReverseSubtract == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kDC == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrc: case SkBlendMode::kSrc:
@ -685,9 +686,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDst: case SkBlendMode::kDst:
@ -696,9 +697,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); TEST_ASSERT(!xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcOver: case SkBlendMode::kSrcOver:
@ -707,9 +708,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstOver: case SkBlendMode::kDstOver:
@ -718,9 +719,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcIn: case SkBlendMode::kSrcIn:
@ -729,9 +730,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstIn: case SkBlendMode::kDstIn:
@ -740,9 +741,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); TEST_ASSERT(!xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcOut: case SkBlendMode::kSrcOut:
@ -751,9 +752,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstOut: case SkBlendMode::kDstOut:
@ -762,9 +763,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kCoverage_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kReverseSubtract == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kDC == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcATop: case SkBlendMode::kSrcATop:
@ -773,9 +774,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstATop: case SkBlendMode::kDstATop:
@ -784,9 +785,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kXor: case SkBlendMode::kXor:
@ -795,9 +796,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kPlus: case SkBlendMode::kPlus:
@ -806,18 +807,18 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kModulate: case SkBlendMode::kModulate:
TEST_ASSERT(!xpi.fIgnoresInputColor); TEST_ASSERT(!xpi.fIgnoresInputColor);
TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kISCModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kReverseSubtract_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kReverseSubtract == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kDC_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kDC == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kScreen: case SkBlendMode::kScreen:
@ -826,9 +827,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISC == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
default: default:
@ -853,9 +854,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(xpi.fUnaffectedByDstValue); TEST_ASSERT(xpi.fUnaffectedByDstValue);
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrc: case SkBlendMode::kSrc:
@ -864,9 +865,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(xpi.fUnaffectedByDstValue); TEST_ASSERT(xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDst: case SkBlendMode::kDst:
@ -875,9 +876,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); TEST_ASSERT(!xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcOver: case SkBlendMode::kSrcOver:
@ -887,12 +888,12 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(xpi.fUnaffectedByDstValue); TEST_ASSERT(xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
if (caps.shouldCollapseSrcOverToSrcWhenAble()) { if (caps.shouldCollapseSrcOverToSrcWhenAble()) {
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
} else { } else {
TEST_ASSERT(kISA_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISA == xpi.fBlendInfo.fDstBlend);
} }
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
@ -902,9 +903,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcIn: case SkBlendMode::kSrcIn:
@ -913,9 +914,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstIn: case SkBlendMode::kDstIn:
@ -924,9 +925,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(!xpi.fBlendInfo.fWriteColor); TEST_ASSERT(!xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcOut: case SkBlendMode::kSrcOut:
@ -935,9 +936,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstOut: case SkBlendMode::kDstOut:
@ -946,9 +947,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(xpi.fUnaffectedByDstValue); TEST_ASSERT(xpi.fUnaffectedByDstValue);
TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kSrcATop: case SkBlendMode::kSrcATop:
@ -957,9 +958,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kDstATop: case SkBlendMode::kDstATop:
@ -968,9 +969,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kXor: case SkBlendMode::kXor:
@ -979,9 +980,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kIDA_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kIDA == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kPlus: case SkBlendMode::kPlus:
@ -990,9 +991,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kModulate: case SkBlendMode::kModulate:
@ -1001,9 +1002,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kZero_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kZero == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kSC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kSC == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
case SkBlendMode::kScreen: case SkBlendMode::kScreen:
@ -1012,9 +1013,9 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
TEST_ASSERT(!xpi.fUnaffectedByDstValue); TEST_ASSERT(!xpi.fUnaffectedByDstValue);
TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType); TEST_ASSERT(kModulate_OutputType == xpi.fPrimaryOutputType);
TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType); TEST_ASSERT(kNone_OutputType == xpi.fSecondaryOutputType);
TEST_ASSERT(kAdd_GrBlendEquation == xpi.fBlendInfo.fEquation); TEST_ASSERT(skgpu::BlendEquation::kAdd == xpi.fBlendInfo.fEquation);
TEST_ASSERT(kOne_GrBlendCoeff == xpi.fBlendInfo.fSrcBlend); TEST_ASSERT(skgpu::BlendCoeff::kOne == xpi.fBlendInfo.fSrcBlend);
TEST_ASSERT(kISC_GrBlendCoeff == xpi.fBlendInfo.fDstBlend); TEST_ASSERT(skgpu::BlendCoeff::kISC == xpi.fBlendInfo.fDstBlend);
TEST_ASSERT(xpi.fBlendInfo.fWriteColor); TEST_ASSERT(xpi.fBlendInfo.fWriteColor);
break; break;
default: default: