Reland "Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView."
This reverts commit c5c024791bb7a587223b807e00ffba4a3eb5fdb7.
Reason for revert: Doh
Original change's description:
> Revert "Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView."
>
> This reverts commit acf5929ae0addc5188117142fd3fb39828baa8d5.
>
> Reason for revert: May be blocking Chrome roll
> Original change's description:
> > Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView.
> >
> > In future CLs I will update the Ops that create the TextureSamplers to pass
> > the GrSurfaceProxyView in.
> >
> > Bug: skia:9556
> > Change-Id: I550dab64974d32e4c3047188063efa2d0832328e
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259164
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Michael Ludwig <michaelludwig@google.com>
>
> TBR=egdaniel@google.com,michaelludwig@google.com
>
> Change-Id: Ic804a52c5c6d16a13a9cc2d85bb959f305134177
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:9556
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259433
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
TBR=egdaniel@google.com,robertphillips@google.com,michaelludwig@google.com
Change-Id: If2af5b5b323858e59c0c8db3b75477d74d78abfd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9556
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259434
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index a61ac18..d090cbd 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -222,22 +222,24 @@
void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman,
const GrTextureDomain& textureDomain,
- const GrSurfaceProxy* proxy,
+ const GrSurfaceProxyView& view,
const GrSamplerState& state) {
// We want a hard transition from texture content to trans-black in nearest mode.
bool filterDecal = state.filter() != GrSamplerState::Filter::kNearest;
- this->setData(pdman, textureDomain, proxy, filterDecal);
+ this->setData(pdman, textureDomain, view.proxy(), view.origin(), filterDecal);
}
void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman,
const GrTextureDomain& textureDomain,
bool filterIfDecal) {
- this->setData(pdman, textureDomain, nullptr, filterIfDecal);
+ // The origin we pass here doesn't matter
+ this->setData(pdman, textureDomain, nullptr, kTopLeft_GrSurfaceOrigin, filterIfDecal);
}
void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman,
const GrTextureDomain& textureDomain,
const GrSurfaceProxy* proxy,
+ GrSurfaceOrigin origin,
bool filterIfDecal) {
SkASSERT(fHasMode && textureDomain.modeX() == fModeX && textureDomain.modeY() == fModeY);
if (kIgnore_Mode == textureDomain.modeX() && kIgnore_Mode == textureDomain.modeY()) {
@@ -290,7 +292,7 @@
}
// vertical flip if necessary
- if (kBottomLeft_GrSurfaceOrigin == proxy->origin()) {
+ if (kBottomLeft_GrSurfaceOrigin == origin) {
tempDomainValues[1] = h - tempDomainValues[1];
tempDomainValues[3] = h - tempDomainValues[3];
@@ -438,7 +440,11 @@
const GrFragmentProcessor& fp) override {
const GrDomainEffect& de = fp.cast<GrDomainEffect>();
const GrTextureDomain& domain = de.fDomain;
- fGLDomain.setData(pdman, domain, de.fCoordTransform.proxy(), de.fDecalIsFiltered);
+ // TODO: Update GrCoordTransform to return a view instead of proxy
+ const GrSurfaceProxy* proxy = de.fCoordTransform.proxy();
+ // If we don't have a proxy the value of the origin doesn't matter
+ GrSurfaceOrigin origin = proxy ? proxy->origin() : kTopLeft_GrSurfaceOrigin;
+ fGLDomain.setData(pdman, domain, proxy, origin, de.fDecalIsFiltered);
}
private:
@@ -559,10 +565,10 @@
const GrFragmentProcessor& fp) override {
const GrDeviceSpaceTextureDecalFragmentProcessor& dstdfp =
fp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>();
- GrSurfaceProxy* proxy = dstdfp.textureSampler(0).proxy();
- SkISize textureDims = proxy->backingStoreDimensions();
+ const auto& view = dstdfp.textureSampler(0).view();
+ SkISize textureDims = view.proxy()->backingStoreDimensions();
- fGLDomain.setData(pdman, dstdfp.fTextureDomain, proxy,
+ fGLDomain.setData(pdman, dstdfp.fTextureDomain, view,
dstdfp.textureSampler(0).samplerState());
float iw = 1.f / textureDims.width();
float ih = 1.f / textureDims.height();
@@ -570,7 +576,7 @@
iw, ih,
-dstdfp.fDeviceSpaceOffset.fX * iw, -dstdfp.fDeviceSpaceOffset.fY * ih
};
- if (proxy->origin() == kBottomLeft_GrSurfaceOrigin) {
+ if (view.origin() == kBottomLeft_GrSurfaceOrigin) {
scaleAndTransData[1] = -scaleAndTransData[1];
scaleAndTransData[3] = 1 - scaleAndTransData[3];
}
@@ -588,8 +594,8 @@
bool GrDeviceSpaceTextureDecalFragmentProcessor::onIsEqual(const GrFragmentProcessor& fp) const {
const GrDeviceSpaceTextureDecalFragmentProcessor& dstdfp =
fp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>();
- return dstdfp.fTextureSampler.proxy()->underlyingUniqueID() ==
- fTextureSampler.proxy()->underlyingUniqueID() &&
+ return dstdfp.fTextureSampler.view().proxy()->underlyingUniqueID() ==
+ fTextureSampler.view().proxy()->underlyingUniqueID() &&
dstdfp.fDeviceSpaceOffset == fDeviceSpaceOffset &&
dstdfp.fTextureDomain == fTextureDomain;
}