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>
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 9891815..576fac6 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -254,7 +254,7 @@
std::unique_ptr<GrFragmentProcessor> clone() const override {
return std::unique_ptr<GrFragmentProcessor>(
- new ColorTableEffect(sk_ref_sp(fTextureSampler.view().proxy())));
+ new ColorTableEffect(sk_ref_sp(fTextureSampler.proxy())));
}
private:
diff --git a/src/effects/imagefilters/SkDisplacementMapEffect.cpp b/src/effects/imagefilters/SkDisplacementMapEffect.cpp
index 73d6af4..f18072b 100644
--- a/src/effects/imagefilters/SkDisplacementMapEffect.cpp
+++ b/src/effects/imagefilters/SkDisplacementMapEffect.cpp
@@ -648,15 +648,15 @@
void GrGLDisplacementMapEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& proc) {
const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMapEffect>();
- const auto& view = displacementMap.textureSampler(1).view();
- SkISize texDimensions = view.proxy()->backingStoreDimensions();
+ GrSurfaceProxy* proxy = displacementMap.textureSampler(1).proxy();
+ SkISize texDimensions = proxy->backingStoreDimensions();
SkScalar scaleX = displacementMap.scale().fX / texDimensions.width();
SkScalar scaleY = displacementMap.scale().fY / texDimensions.height();
pdman.set2f(fScaleUni, SkScalarToFloat(scaleX),
- view.origin() == kTopLeft_GrSurfaceOrigin ?
+ proxy->origin() == kTopLeft_GrSurfaceOrigin ?
SkScalarToFloat(scaleY) : SkScalarToFloat(-scaleY));
- fGLDomain.setData(pdman, displacementMap.domain(), view,
+ fGLDomain.setData(pdman, displacementMap.domain(), proxy,
displacementMap.textureSampler(1).samplerState());
}
diff --git a/src/effects/imagefilters/SkLightingImageFilter.cpp b/src/effects/imagefilters/SkLightingImageFilter.cpp
index de96aa5..e18e7ab 100644
--- a/src/effects/imagefilters/SkLightingImageFilter.cpp
+++ b/src/effects/imagefilters/SkLightingImageFilter.cpp
@@ -1840,15 +1840,15 @@
fLight = lighting.light()->createGLLight();
}
- const GrSurfaceProxyView& view = lighting.textureSampler(0).view();
- SkISize textureDims = view.proxy()->backingStoreDimensions();
+ GrSurfaceProxy* proxy = lighting.textureSampler(0).proxy();
+ SkISize textureDims = proxy->backingStoreDimensions();
- float ySign = view.origin() == kTopLeft_GrSurfaceOrigin ? -1.0f : 1.0f;
+ float ySign = proxy->origin() == kTopLeft_GrSurfaceOrigin ? -1.0f : 1.0f;
pdman.set2f(fImageIncrementUni, 1.0f / textureDims.width(), ySign / textureDims.height());
pdman.set1f(fSurfaceScaleUni, lighting.surfaceScale());
sk_sp<SkImageFilterLight> transformedLight(
lighting.light()->transform(lighting.filterMatrix()));
- fDomain.setData(pdman, lighting.domain(), view, lighting.textureSampler(0).samplerState());
+ fDomain.setData(pdman, lighting.domain(), proxy, lighting.textureSampler(0).samplerState());
fLight->setData(pdman, transformedLight.get());
}
diff --git a/src/effects/imagefilters/SkMorphologyImageFilter.cpp b/src/effects/imagefilters/SkMorphologyImageFilter.cpp
index 79b5559..b039089 100644
--- a/src/effects/imagefilters/SkMorphologyImageFilter.cpp
+++ b/src/effects/imagefilters/SkMorphologyImageFilter.cpp
@@ -363,8 +363,7 @@
void GrGLMorphologyEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& proc) {
const GrMorphologyEffect& m = proc.cast<GrMorphologyEffect>();
- const auto& view = m.textureSampler(0).view();
- GrSurfaceProxy* proxy = view.proxy();
+ GrSurfaceProxy* proxy = m.textureSampler(0).proxy();
GrTexture& texture = *proxy->peekTexture();
float pixelSize = 0.0f;
@@ -383,7 +382,7 @@
if (m.useRange()) {
const float* range = m.range();
if (MorphDirection::kY == m.direction() &&
- view.origin() == kBottomLeft_GrSurfaceOrigin) {
+ proxy->origin() == kBottomLeft_GrSurfaceOrigin) {
pdman.set2f(fRangeUni, 1.0f - (range[1]*pixelSize), 1.0f - (range[0]*pixelSize));
} else {
pdman.set2f(fRangeUni, range[0] * pixelSize, range[1] * pixelSize);
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp
index 6760aa7..b836be4 100644
--- a/src/gpu/GrFragmentProcessor.cpp
+++ b/src/gpu/GrFragmentProcessor.cpp
@@ -50,7 +50,7 @@
void GrFragmentProcessor::visitProxies(const GrOp::VisitProxyFunc& func) {
for (auto [sampler, fp] : FPTextureSamplerRange(*this)) {
bool mipped = (GrSamplerState::Filter::kMipMap == sampler.samplerState().filter());
- func(sampler.view().proxy(), GrMipMapped(mipped));
+ func(sampler.proxy(), GrMipMapped(mipped));
}
}
@@ -412,39 +412,17 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
-GrFragmentProcessor::TextureSampler::TextureSampler(GrSurfaceProxyView view,
- const GrSamplerState& samplerState)
- : fView(std::move(view))
- , fSamplerState(samplerState) {
- GrSurfaceProxy* proxy = this->proxy();
- fSamplerState.setFilterMode(
- SkTMin(samplerState.filter(),
- GrTextureProxy::HighestFilterMode(proxy->backendFormat().textureType())));
-}
-
GrFragmentProcessor::TextureSampler::TextureSampler(sk_sp<GrSurfaceProxy> proxy,
const GrSamplerState& samplerState) {
+ this->reset(std::move(proxy), samplerState);
+}
+
+void GrFragmentProcessor::TextureSampler::reset(sk_sp<GrSurfaceProxy> proxy,
+ const GrSamplerState& samplerState) {
SkASSERT(proxy->asTextureProxy());
- GrSurfaceOrigin origin = proxy->origin();
- GrSwizzle swizzle = proxy->textureSwizzle();
- fView = GrSurfaceProxyView(std::move(proxy), origin, swizzle);
-
+ fProxy = std::move(proxy);
fSamplerState = samplerState;
- GrSurfaceProxy* surfProxy = this->proxy();
fSamplerState.setFilterMode(
SkTMin(samplerState.filter(),
- GrTextureProxy::HighestFilterMode(surfProxy->backendFormat().textureType())));
+ GrTextureProxy::HighestFilterMode(fProxy->backendFormat().textureType())));
}
-
-#if GR_TEST_UTILS
-void GrFragmentProcessor::TextureSampler::set(GrSurfaceProxyView view,
- const GrSamplerState& samplerState) {
- SkASSERT(view.proxy()->asTextureProxy());
- fView = std::move(view);
- fSamplerState = samplerState;
-
- fSamplerState.setFilterMode(
- SkTMin(samplerState.filter(),
- GrTextureProxy::HighestFilterMode(this->proxy()->backendFormat().textureType())));
-}
-#endif
diff --git a/src/gpu/GrFragmentProcessor.h b/src/gpu/GrFragmentProcessor.h
index 2622dcc..db6e437 100644
--- a/src/gpu/GrFragmentProcessor.h
+++ b/src/gpu/GrFragmentProcessor.h
@@ -476,41 +476,38 @@
* This copy constructor is used by GrFragmentProcessor::clone() implementations.
*/
explicit TextureSampler(const TextureSampler& that)
- : fView(that.fView)
+ : fProxy(that.fProxy)
, fSamplerState(that.fSamplerState) {}
- TextureSampler(GrSurfaceProxyView, const GrSamplerState& = GrSamplerState::ClampNearest());
- // TODO: Remove this ctor once all uses have been updated to pass in a GrSurfaceProxyView
TextureSampler(sk_sp<GrSurfaceProxy>, const GrSamplerState& = GrSamplerState::ClampNearest());
TextureSampler& operator=(const TextureSampler&) = delete;
+ void reset(sk_sp<GrSurfaceProxy>, const GrSamplerState&);
+
bool operator==(const TextureSampler& that) const {
- return fView == that.fView && fSamplerState == that.fSamplerState;
+ return this->proxy()->underlyingUniqueID() == that.proxy()->underlyingUniqueID() &&
+ fSamplerState == that.fSamplerState;
}
bool operator!=(const TextureSampler& other) const { return !(*this == other); }
- SkDEBUGCODE(bool isInstantiated() const { return this->proxy()->isInstantiated(); })
+ SkDEBUGCODE(bool isInstantiated() const { return fProxy->isInstantiated(); })
// 'peekTexture' should only ever be called after a successful 'instantiate' call
GrTexture* peekTexture() const {
- SkASSERT(this->proxy()->isInstantiated());
- return this->proxy()->peekTexture();
+ SkASSERT(fProxy->isInstantiated());
+ return fProxy->peekTexture();
}
- const GrSurfaceProxyView& view() const { return fView; }
+ GrSurfaceProxy* proxy() const { return fProxy.get(); }
const GrSamplerState& samplerState() const { return fSamplerState; }
+ const GrSwizzle& swizzle() const { return this->proxy()->textureSwizzle(); }
- bool isInitialized() const { return SkToBool(this->proxy()); }
+ bool isInitialized() const { return SkToBool(fProxy.get()); }
-#if GR_TEST_UTILS
- void set(GrSurfaceProxyView, const GrSamplerState&);
-#endif
private:
- GrSurfaceProxy* proxy() const { return fView.proxy(); }
-
- GrSurfaceProxyView fView;
+ sk_sp<GrSurfaceProxy> fProxy;
GrSamplerState fSamplerState;
};
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 9a44ce4..f653542 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -116,7 +116,7 @@
// This iteration includes any clip coverage FPs
for (auto [sampler, fp] : GrFragmentProcessor::PipelineTextureSamplerRange(*this)) {
bool mipped = (GrSamplerState::Filter::kMipMap == sampler.samplerState().filter());
- func(sampler.view().proxy(), GrMipMapped(mipped));
+ func(sampler.proxy(), GrMipMapped(mipped));
}
if (fDstProxyView.asTextureProxy()) {
func(fDstProxyView.asTextureProxy(), GrMipMapped::kNo);
diff --git a/src/gpu/GrProcessorSet.cpp b/src/gpu/GrProcessorSet.cpp
index 054866b..cf75415 100644
--- a/src/gpu/GrProcessorSet.cpp
+++ b/src/gpu/GrProcessorSet.cpp
@@ -255,6 +255,6 @@
void GrProcessorSet::visitProxies(const GrOp::VisitProxyFunc& func) const {
for (auto [sampler, fp] : GrFragmentProcessor::ProcessorSetTextureSamplerRange(*this)) {
bool mipped = (GrSamplerState::Filter::kMipMap == sampler.samplerState().filter());
- func(sampler.view().proxy(), GrMipMapped(mipped));
+ func(sampler.proxy(), GrMipMapped(mipped));
}
}
diff --git a/src/gpu/GrProgramDesc.cpp b/src/gpu/GrProgramDesc.cpp
index c1e5cd3..38161c6 100644
--- a/src/gpu/GrProgramDesc.cpp
+++ b/src/gpu/GrProgramDesc.cpp
@@ -64,10 +64,9 @@
}
for (int i = 0; i < numTextureSamplers; ++i) {
const GrFragmentProcessor::TextureSampler& sampler = fp.textureSampler(i);
- const GrBackendFormat& backendFormat = sampler.view().proxy()->backendFormat();
+ const GrBackendFormat& backendFormat = sampler.proxy()->backendFormat();
- uint32_t samplerKey = sampler_key(backendFormat.textureType(), sampler.view().swizzle(),
- caps);
+ uint32_t samplerKey = sampler_key(backendFormat.textureType(), sampler.swizzle(), caps);
b->add32(samplerKey);
caps.addExtraSamplerKey(b, sampler.samplerState(), backendFormat);
diff --git a/src/gpu/ccpr/GrCCClipProcessor.cpp b/src/gpu/ccpr/GrCCClipProcessor.cpp
index 76293e2..a4656fa 100644
--- a/src/gpu/ccpr/GrCCClipProcessor.cpp
+++ b/src/gpu/ccpr/GrCCClipProcessor.cpp
@@ -21,7 +21,7 @@
, fIsCoverageCount(IsCoverageCount::kYes == isCoverageCount)
, fMustCheckBounds(MustCheckBounds::kYes == mustCheckBounds)
, fAtlasAccess(sk_ref_sp(fClipPath->atlasLazyProxy())) {
- SkASSERT(fAtlasAccess.view().proxy());
+ SkASSERT(fAtlasAccess.proxy());
this->setTextureSamplerCnt(1);
}
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index 9235bd3..973ef45 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -145,8 +145,8 @@
void GrGLBicubicEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& processor) {
const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>();
- const auto& view = processor.textureSampler(0).view();
- SkISize textureDims = view.proxy()->backingStoreDimensions();
+ GrSurfaceProxy* proxy = processor.textureSampler(0).proxy();
+ SkISize textureDims = proxy->backingStoreDimensions();
float dims[4] = {0, 0, 0, 0};
if (bicubicEffect.direction() != GrBicubicEffect::Direction::kY) {
@@ -158,7 +158,7 @@
dims[3] = textureDims.height();
}
pdman.set4fv(fDimensions, 1, dims);
- fDomain.setData(pdman, bicubicEffect.domain(), view,
+ fDomain.setData(pdman, bicubicEffect.domain(), proxy,
processor.textureSampler(0).samplerState());
}
diff --git a/src/gpu/effects/GrCircleBlurFragmentProcessor.fp b/src/gpu/effects/GrCircleBlurFragmentProcessor.fp
index a710b2d..4228a03 100644
--- a/src/gpu/effects/GrCircleBlurFragmentProcessor.fp
+++ b/src/gpu/effects/GrCircleBlurFragmentProcessor.fp
@@ -253,6 +253,8 @@
if (!blurProfile) {
return nullptr;
}
+
+ SkASSERT(blurProfile->origin() == kTopLeft_GrSurfaceOrigin);
proxyProvider->assignUniqueKeyToProxy(key, blurProfile.get());
}
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
index 80bc165..cc6b8d2 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
@@ -123,12 +123,11 @@
const GrFragmentProcessor& processor) {
const GrGaussianConvolutionFragmentProcessor& conv =
processor.cast<GrGaussianConvolutionFragmentProcessor>();
- const auto& view = conv.textureSampler(0).view();
- GrSurfaceProxy* proxy = view.proxy();
+ GrSurfaceProxy* proxy = conv.textureSampler(0).proxy();
GrTexture& texture = *proxy->peekTexture();
float imageIncrement[2] = {0};
- float ySign = view.origin() != kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
+ float ySign = proxy->origin() != kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
switch (conv.direction()) {
case Direction::kX:
imageIncrement[0] = 1.0f / texture.width();
@@ -154,7 +153,7 @@
bounds[1] *= inv;
} else {
SkScalar inv = SkScalarInvert(SkIntToScalar(texture.height()));
- if (view.origin() != kTopLeft_GrSurfaceOrigin) {
+ if (proxy->origin() != kTopLeft_GrSurfaceOrigin) {
float tmp = bounds[0];
bounds[0] = 1.0f - (inv * bounds[1]);
bounds[1] = 1.0f - (inv * tmp);
diff --git a/src/gpu/effects/GrMagnifierEffect.fp b/src/gpu/effects/GrMagnifierEffect.fp
index fba7807..e6a9aa2 100644
--- a/src/gpu/effects/GrMagnifierEffect.fp
+++ b/src/gpu/effects/GrMagnifierEffect.fp
@@ -47,7 +47,7 @@
{
SkScalar y = srcRect.y() * invH;
- if (srcView.origin() != kTopLeft_GrSurfaceOrigin) {
+ if (srcProxy.origin() != kTopLeft_GrSurfaceOrigin) {
y = 1.0f - (srcRect.height() / bounds.height()) - y;
}
@@ -57,7 +57,7 @@
{
SkScalar y = bounds.y() * invH;
SkScalar hSign = 1.f;
- if (srcView.origin() != kTopLeft_GrSurfaceOrigin) {
+ if (srcProxy.origin() != kTopLeft_GrSurfaceOrigin) {
y = 1.0f - bounds.y() * invH;
hSign = -1.f;
}
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 12decaf..1f70a53 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -125,11 +125,11 @@
void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& processor) {
const GrMatrixConvolutionEffect& conv = processor.cast<GrMatrixConvolutionEffect>();
- const auto& view = conv.textureSampler(0).view();
- SkISize textureDims = view.proxy()->backingStoreDimensions();
+ GrSurfaceProxy* proxy = conv.textureSampler(0).proxy();
+ SkISize textureDims = proxy->backingStoreDimensions();
float imageIncrement[2];
- float ySign = view.origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
+ float ySign = proxy->origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
imageIncrement[0] = 1.0f / textureDims.width();
imageIncrement[1] = ySign / textureDims.height();
pdman.set2fv(fImageIncrementUni, 1, imageIncrement);
@@ -140,7 +140,7 @@
pdman.set4fv(fKernelUni, arrayCount, conv.kernel());
pdman.set1f(fGainUni, conv.gain());
pdman.set1f(fBiasUni, conv.bias());
- fDomain.setData(pdman, conv.domain(), view, conv.textureSampler(0).samplerState());
+ fDomain.setData(pdman, conv.domain(), proxy, conv.textureSampler(0).samplerState());
}
GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(sk_sp<GrSurfaceProxy> srcProxy,
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index d090cbd..a61ac18 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -222,24 +222,22 @@
void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman,
const GrTextureDomain& textureDomain,
- const GrSurfaceProxyView& view,
+ const GrSurfaceProxy* proxy,
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, view.proxy(), view.origin(), filterDecal);
+ this->setData(pdman, textureDomain, proxy, filterDecal);
}
void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman,
const GrTextureDomain& textureDomain,
bool filterIfDecal) {
- // The origin we pass here doesn't matter
- this->setData(pdman, textureDomain, nullptr, kTopLeft_GrSurfaceOrigin, filterIfDecal);
+ this->setData(pdman, textureDomain, nullptr, 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()) {
@@ -292,7 +290,7 @@
}
// vertical flip if necessary
- if (kBottomLeft_GrSurfaceOrigin == origin) {
+ if (kBottomLeft_GrSurfaceOrigin == proxy->origin()) {
tempDomainValues[1] = h - tempDomainValues[1];
tempDomainValues[3] = h - tempDomainValues[3];
@@ -440,11 +438,7 @@
const GrFragmentProcessor& fp) override {
const GrDomainEffect& de = fp.cast<GrDomainEffect>();
const GrTextureDomain& domain = de.fDomain;
- // 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);
+ fGLDomain.setData(pdman, domain, de.fCoordTransform.proxy(), de.fDecalIsFiltered);
}
private:
@@ -565,10 +559,10 @@
const GrFragmentProcessor& fp) override {
const GrDeviceSpaceTextureDecalFragmentProcessor& dstdfp =
fp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>();
- const auto& view = dstdfp.textureSampler(0).view();
- SkISize textureDims = view.proxy()->backingStoreDimensions();
+ GrSurfaceProxy* proxy = dstdfp.textureSampler(0).proxy();
+ SkISize textureDims = proxy->backingStoreDimensions();
- fGLDomain.setData(pdman, dstdfp.fTextureDomain, view,
+ fGLDomain.setData(pdman, dstdfp.fTextureDomain, proxy,
dstdfp.textureSampler(0).samplerState());
float iw = 1.f / textureDims.width();
float ih = 1.f / textureDims.height();
@@ -576,7 +570,7 @@
iw, ih,
-dstdfp.fDeviceSpaceOffset.fX * iw, -dstdfp.fDeviceSpaceOffset.fY * ih
};
- if (view.origin() == kBottomLeft_GrSurfaceOrigin) {
+ if (proxy->origin() == kBottomLeft_GrSurfaceOrigin) {
scaleAndTransData[1] = -scaleAndTransData[1];
scaleAndTransData[3] = 1 - scaleAndTransData[3];
}
@@ -594,8 +588,8 @@
bool GrDeviceSpaceTextureDecalFragmentProcessor::onIsEqual(const GrFragmentProcessor& fp) const {
const GrDeviceSpaceTextureDecalFragmentProcessor& dstdfp =
fp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>();
- return dstdfp.fTextureSampler.view().proxy()->underlyingUniqueID() ==
- fTextureSampler.view().proxy()->underlyingUniqueID() &&
+ return dstdfp.fTextureSampler.proxy()->underlyingUniqueID() ==
+ fTextureSampler.proxy()->underlyingUniqueID() &&
dstdfp.fDeviceSpaceOffset == fDeviceSpaceOffset &&
dstdfp.fTextureDomain == fTextureDomain;
}
diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h
index 88e6555..53f3fcb 100644
--- a/src/gpu/effects/GrTextureDomain.h
+++ b/src/gpu/effects/GrTextureDomain.h
@@ -178,11 +178,11 @@
* account for the texture's origin. Filtering at the edge of the domain is inferred from
* the GrSamplerState's filter mode.
*/
- void setData(const GrGLSLProgramDataManager&, const GrTextureDomain&,
- const GrSurfaceProxyView&, const GrSamplerState& state);
+ void setData(const GrGLSLProgramDataManager&, const GrTextureDomain&, const GrSurfaceProxy*,
+ const GrSamplerState& state);
/** Same as above but with direct control over decal filtering. */
void setData(const GrGLSLProgramDataManager&, const GrTextureDomain&, const GrSurfaceProxy*,
- GrSurfaceOrigin, bool filterIfDecal);
+ bool filterIfDecal);
enum {
kModeBits = 3, // See DomainKey().
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index 4d2d732..8af97f1 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -100,8 +100,8 @@
SkString str;
for (int i = 0; i < this->numTextureSamplers(); ++i) {
str.appendf("%d: %d %d ", i,
- this->textureSampler(i).view().proxy()->uniqueID().asUInt(),
- this->textureSampler(i).view().proxy()->underlyingUniqueID().asUInt());
+ this->textureSampler(i).proxy()->uniqueID().asUInt(),
+ this->textureSampler(i).proxy()->underlyingUniqueID().asUInt());
}
str.appendf("\n");
diff --git a/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp b/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
index 863e88f..3d5a925 100644
--- a/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
+++ b/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
@@ -230,6 +230,8 @@
if (!blurProfile) {
return nullptr;
}
+
+ SkASSERT(blurProfile->origin() == kTopLeft_GrSurfaceOrigin);
proxyProvider->assignUniqueKeyToProxy(key, blurProfile.get());
}
@@ -298,8 +300,8 @@
(void)textureRadius;
auto solidRadius = _outer.solidRadius;
(void)solidRadius;
- const GrSurfaceProxyView& blurProfileSamplerView = _outer.textureSampler(0).view();
- GrTexture& blurProfileSampler = *blurProfileSamplerView.proxy()->peekTexture();
+ GrSurfaceProxy& blurProfileSamplerProxy = *_outer.textureSampler(0).proxy();
+ GrTexture& blurProfileSampler = *blurProfileSamplerProxy.peekTexture();
(void)blurProfileSampler;
UniformHandle& circleData = circleDataVar;
(void)circleData;
diff --git a/src/gpu/effects/generated/GrMagnifierEffect.cpp b/src/gpu/effects/generated/GrMagnifierEffect.cpp
index a6522b5..5a29834 100644
--- a/src/gpu/effects/generated/GrMagnifierEffect.cpp
+++ b/src/gpu/effects/generated/GrMagnifierEffect.cpp
@@ -85,8 +85,8 @@
pdman.set1f(xInvInsetVar, (_outer.xInvInset));
pdman.set1f(yInvInsetVar, (_outer.yInvInset));
}
- const GrSurfaceProxyView& srcView = _outer.textureSampler(0).view();
- GrTexture& src = *srcView.proxy()->peekTexture();
+ GrSurfaceProxy& srcProxy = *_outer.textureSampler(0).proxy();
+ GrTexture& src = *srcProxy.peekTexture();
(void)src;
auto bounds = _outer.bounds;
(void)bounds;
@@ -110,7 +110,7 @@
{
SkScalar y = srcRect.y() * invH;
- if (srcView.origin() != kTopLeft_GrSurfaceOrigin) {
+ if (srcProxy.origin() != kTopLeft_GrSurfaceOrigin) {
y = 1.0f - (srcRect.height() / bounds.height()) - y;
}
@@ -120,7 +120,7 @@
{
SkScalar y = bounds.y() * invH;
SkScalar hSign = 1.f;
- if (srcView.origin() != kTopLeft_GrSurfaceOrigin) {
+ if (srcProxy.origin() != kTopLeft_GrSurfaceOrigin) {
y = 1.0f - bounds.y() * invH;
hSign = -1.f;
}
diff --git a/src/gpu/effects/generated/GrRRectBlurEffect.cpp b/src/gpu/effects/generated/GrRRectBlurEffect.cpp
index 71f50d7..35cf1fe 100644
--- a/src/gpu/effects/generated/GrRRectBlurEffect.cpp
+++ b/src/gpu/effects/generated/GrRRectBlurEffect.cpp
@@ -111,8 +111,8 @@
(void)rect;
UniformHandle& cornerRadius = cornerRadiusVar;
(void)cornerRadius;
- const GrSurfaceProxyView& ninePatchSamplerView = _outer.textureSampler(0).view();
- GrTexture& ninePatchSampler = *ninePatchSamplerView.proxy()->peekTexture();
+ GrSurfaceProxy& ninePatchSamplerProxy = *_outer.textureSampler(0).proxy();
+ GrTexture& ninePatchSampler = *ninePatchSamplerProxy.peekTexture();
(void)ninePatchSampler;
UniformHandle& proxyRect = proxyRectVar;
(void)proxyRect;
diff --git a/src/gpu/effects/generated/GrRectBlurEffect.cpp b/src/gpu/effects/generated/GrRectBlurEffect.cpp
index 8ba9506..7643406 100644
--- a/src/gpu/effects/generated/GrRectBlurEffect.cpp
+++ b/src/gpu/effects/generated/GrRectBlurEffect.cpp
@@ -132,8 +132,8 @@
(void)rectF;
UniformHandle& rectH = rectHVar;
(void)rectH;
- const GrSurfaceProxyView& integralView = _outer.textureSampler(0).view();
- GrTexture& integral = *integralView.proxy()->peekTexture();
+ GrSurfaceProxy& integralProxy = *_outer.textureSampler(0).proxy();
+ GrTexture& integral = *integralProxy.peekTexture();
(void)integral;
UniformHandle& invSixSigma = invSixSigmaVar;
(void)invSixSigma;
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 23442c5..53760e6 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -124,8 +124,7 @@
glslIter->setData(fProgramDataManager, *fpIter);
for (int i = 0; i < fpIter->numTextureSamplers(); ++i) {
const GrFragmentProcessor::TextureSampler& sampler = fpIter->textureSampler(i);
- fGpu->bindTexture((*nextTexSamplerIdx)++, sampler.samplerState(),
- sampler.view().swizzle(),
+ fGpu->bindTexture((*nextTexSamplerIdx)++, sampler.samplerState(), sampler.swizzle(),
static_cast<GrGLTexture*>(sampler.peekTexture()));
}
}
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index ffe2ab0..77f7aee 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -190,9 +190,9 @@
SkString name;
name.printf("TextureSampler_%d", samplerIdx++);
const auto& sampler = subFP.textureSampler(i);
- texSamplers.emplace_back(this->emitSampler(sampler.view().proxy(),
+ texSamplers.emplace_back(this->emitSampler(sampler.proxy(),
sampler.samplerState(),
- sampler.view().swizzle(),
+ sampler.swizzle(),
name.c_str()));
}
}
diff --git a/src/sksl/SkSLCPPCodeGenerator.cpp b/src/sksl/SkSLCPPCodeGenerator.cpp
index 6de36bf..f77af09 100644
--- a/src/sksl/SkSLCPPCodeGenerator.cpp
+++ b/src/sksl/SkSLCPPCodeGenerator.cpp
@@ -1018,10 +1018,10 @@
String nameString(decl.fVar->fName);
const char* name = nameString.c_str();
if (decl.fVar->fType.kind() == Type::kSampler_Kind) {
- this->writef(" const GrSurfaceProxyView& %sView = "
- "_outer.textureSampler(%d).view();\n",
+ this->writef(" GrSurfaceProxy& %sProxy = "
+ "*_outer.textureSampler(%d).proxy();\n",
name, samplerIndex);
- this->writef(" GrTexture& %s = *%sView.proxy()->peekTexture();\n",
+ this->writef(" GrTexture& %s = *%sProxy.peekTexture();\n",
name, name);
this->writef(" (void) %s;\n", name);
++samplerIndex;
diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp
index 25499d0..fc9b0e0 100644
--- a/tests/LazyProxyTest.cpp
+++ b/tests/LazyProxyTest.cpp
@@ -131,10 +131,9 @@
, fProxyProvider(proxyProvider)
, fTest(test)
, fAtlas(atlas) {
- static const GrColorType kColorType = GrColorType::kAlpha_F16;
- static const GrSurfaceOrigin kOrigin = kBottomLeft_GrSurfaceOrigin;
const GrBackendFormat format =
- ctx->priv().caps()->getDefaultBackendFormat(kColorType, GrRenderable::kYes);
+ ctx->priv().caps()->getDefaultBackendFormat(GrColorType::kAlpha_F16,
+ GrRenderable::kYes);
fLazyProxy = GrProxyProvider::MakeFullyLazyProxy(
[this](GrResourceProvider* rp) -> GrSurfaceProxy::LazyCallbackResult {
REPORTER_ASSERT(fTest->fReporter, !fTest->fHasClipTexture);
@@ -142,12 +141,10 @@
fAtlas->instantiate(rp);
return sk_ref_sp(fAtlas->peekTexture());
},
- format, GrRenderable::kYes, 1, GrProtected::kNo, kOrigin,
+ format, GrRenderable::kYes, 1, GrProtected::kNo, kBottomLeft_GrSurfaceOrigin,
kAlpha_half_GrPixelConfig, *proxyProvider->caps(),
GrSurfaceProxy::UseAllocator::kYes);
- GrSwizzle swizzle = ctx->priv().caps()->getTextureSwizzle(format, kColorType);
- fAccess.set(GrSurfaceProxyView(fLazyProxy, kOrigin, swizzle),
- GrSamplerState::ClampNearest());
+ fAccess.reset(fLazyProxy, GrSamplerState::ClampNearest());
this->setTextureSamplerCnt(1);
}