Revert "Remove GrDeviceSpaceTextureDecalFragmentProcessor."
This reverts commit af5f9f008de060a91d8069c876a765f11c3d36f6.
Reason for revert: bad GM results on Metal
Original change's description:
> Remove GrDeviceSpaceTextureDecalFragmentProcessor.
>
> It was used to sample clip masks using device coords.
>
> Replace with a more generic GrDeviceSpaceEffect that simply calls a
> child FP with sk_FragCoord.
>
> Also fix issue in GrQuadPerEdgeAA GP. It wouldn't setup coord transforms
> at all if they are all applied in the FS (explicit coords). Moreover,
> the GrGLSLGeometryProcessor::emitTransforms() helper required a valid VS
> var for local coords even when all FPs use explicit coords and wouldn't
> use a local coords var.
>
> Make CPP SkSL code gen for clone copy the explicit coord status of
> children.
>
> Change-Id: Ib8bb36028354405c8012f6e91e9eb46db75d16a6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271658
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=bsalomon@google.com,brianosman@google.com
Change-Id: Ie02951dcc037d282dc3829cad216a0a0c9474038
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272518
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 66f2de8..2c5a941 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -5,13 +5,12 @@
* found in the LICENSE file.
*/
-#include "src/gpu/GrClipStackClip.h"
-
#include "include/private/SkTo.h"
#include "src/core/SkClipOpPriv.h"
#include "src/core/SkTaskGroup.h"
#include "src/core/SkTraceEvent.h"
#include "src/gpu/GrAppliedClip.h"
+#include "src/gpu/GrClipStackClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrDeferredProxyUploader.h"
#include "src/gpu/GrDrawingManager.h"
@@ -27,7 +26,6 @@
#include "src/gpu/effects/GrConvexPolyEffect.h"
#include "src/gpu/effects/GrRRectEffect.h"
#include "src/gpu/effects/GrTextureDomain.h"
-#include "src/gpu/effects/generated/GrDeviceSpaceEffect.h"
#include "src/gpu/geometry/GrShape.h"
typedef SkClipStack::Element Element;
@@ -80,18 +78,11 @@
////////////////////////////////////////////////////////////////////////////////
// set up the draw state to enable the aa clipping mask.
static std::unique_ptr<GrFragmentProcessor> create_fp_for_mask(GrSurfaceProxyView mask,
- const SkIRect& devBound,
- const GrCaps& caps) {
- GrSamplerState samplerState(GrSamplerState::WrapMode::kClampToBorder,
- GrSamplerState::Filter::kNearest);
- auto m = SkMatrix::MakeTrans(-devBound.fLeft, -devBound.fTop);
- auto subset = SkRect::Make(devBound.size());
- // We scissor to devBounds. The mask's texel centers are aligned to device space
- // pixel centers. Hence this domain of texture coordinates.
- auto domain = subset.makeInset(0.5, 0.5);
- auto fp = GrTextureEffect::MakeSubset(std::move(mask), kPremul_SkAlphaType, m, samplerState,
- subset, domain, caps);
- return GrDeviceSpaceEffect::Make(std::move(fp));
+ const SkIRect& devBound) {
+ SkASSERT(mask.asTextureProxy());
+ SkIRect domainTexels = SkIRect::MakeWH(devBound.width(), devBound.height());
+ return GrDeviceSpaceTextureDecalFragmentProcessor::Make(std::move(mask), domainTexels,
+ {devBound.fLeft, devBound.fTop});
}
// Does the path in 'element' require SW rendering? If so, return true (and,
@@ -292,8 +283,7 @@
if (result) {
// The mask's top left coord should be pinned to the rounded-out top left corner of
// the clip's device space bounds.
- out->addCoverageFP(create_fp_for_mask(std::move(result), reducedClip.scissor(),
- *context->priv().caps()));
+ out->addCoverageFP(create_fp_for_mask(std::move(result), reducedClip.scissor()));
return true;
}