Remove GrSurface::flushWrites

Change-Id: Ifac5af00ef852ee212964baa113b490a03e0168d
Reviewed-on: https://skia-review.googlesource.com/10293
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2017-03-28 16:21:27 -04:00 committed by Skia Commit-Bot
parent 334e88c21a
commit 1ec1faaff4
4 changed files with 11 additions and 22 deletions

View File

@ -166,11 +166,6 @@ public:
rowBytes, pixelOpsFlags);
}
/**
* After this returns any pending writes to the surface will be issued to the backend 3D API.
*/
void flushWrites();
/** Access methods that are only to be used within Skia code. */
inline GrSurfacePriv surfacePriv();
inline const GrSurfacePriv surfacePriv() const;

View File

@ -163,12 +163,6 @@ bool GrSurface::readPixels(SkColorSpace* srcColorSpace, int left, int top, int w
dstColorSpace, buffer, rowBytes, pixelOpsFlags);
}
void GrSurface::flushWrites() {
if (!this->wasDestroyed()) {
this->getContext()->flushSurfaceWrites(this);
}
}
bool GrSurface::hasPendingRead() const {
const GrTexture* thisTex = this->asTexture();
if (thisTex && thisTex->internalHasPendingRead()) {

View File

@ -85,7 +85,7 @@ bool GrTextureContext::onCopy(GrSurfaceProxy* srcProxy,
#ifndef ENABLE_MDB
// We can't yet fully defer copies to textures, so GrTextureContext::copySurface will
// execute the copy immediately. Ensure the data is ready.
src->flushWrites();
fContext->flushSurfaceWrites(src.get());
#endif
// TODO: this needs to be fixed up since it ends the deferrable of the GrTexture

View File

@ -65,28 +65,28 @@ static void check_refs(skiatest::Reporter* reporter,
SkASSERT(proxy->getPendingWriteCnt_TestOnly() == expectedNumWrites);
}
static sk_sp<GrSurfaceProxy> make_deferred(GrResourceProvider* provider) {
static sk_sp<GrSurfaceProxy> make_deferred(GrContext* context) {
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = kWidthHeight;
desc.fHeight = kWidthHeight;
desc.fConfig = kRGBA_8888_GrPixelConfig;
return GrSurfaceProxy::MakeDeferred(provider, desc,
return GrSurfaceProxy::MakeDeferred(context->resourceProvider(), desc,
SkBackingFit::kApprox, SkBudgeted::kYes);
}
static sk_sp<GrSurfaceProxy> make_wrapped(GrResourceProvider* provider) {
static sk_sp<GrSurfaceProxy> make_wrapped(GrContext* context) {
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = kWidthHeight;
desc.fHeight = kWidthHeight;
desc.fConfig = kRGBA_8888_GrPixelConfig;
sk_sp<GrTexture> tex(provider->createTexture(desc, SkBudgeted::kNo));
sk_sp<GrTexture> tex(context->resourceProvider()->createTexture(desc, SkBudgeted::kNo));
// Flush the IOWrite from the initial discard or it will confuse the later ref count checks
tex->flushWrites();
context->flushSurfaceWrites(tex.get());
return GrSurfaceProxy::MakeWrapped(std::move(tex));
}
@ -100,7 +100,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
for (auto make : { make_deferred, make_wrapped }) {
// A single write
{
sk_sp<GrSurfaceProxy> sProxy((*make)(provider));
sk_sp<GrSurfaceProxy> sProxy((*make)(ctxInfo.grContext()));
GrPendingIOResource<GrSurfaceProxy, kWrite_GrIOType> fWrite(sProxy.get());
@ -120,7 +120,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
// A single read
{
sk_sp<GrSurfaceProxy> sProxy((*make)(provider));
sk_sp<GrSurfaceProxy> sProxy((*make)(ctxInfo.grContext()));
GrPendingIOResource<GrSurfaceProxy, kRead_GrIOType> fRead(sProxy.get());
@ -140,7 +140,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
// A single read/write pair
{
sk_sp<GrSurfaceProxy> sProxy((*make)(provider));
sk_sp<GrSurfaceProxy> sProxy((*make)(ctxInfo.grContext()));
GrPendingIOResource<GrSurfaceProxy, kRW_GrIOType> fRW(sProxy.get());
@ -160,7 +160,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
// Multiple normal refs
{
sk_sp<GrSurfaceProxy> sProxy((*make)(provider));
sk_sp<GrSurfaceProxy> sProxy((*make)(ctxInfo.grContext()));
sProxy->ref();
sProxy->ref();
@ -181,7 +181,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
// Continue using (reffing) proxy after instantiation
{
sk_sp<GrSurfaceProxy> sProxy((*make)(provider));
sk_sp<GrSurfaceProxy> sProxy((*make)(ctxInfo.grContext()));
sProxy->ref();
GrPendingIOResource<GrSurfaceProxy, kWrite_GrIOType> fWrite(sProxy.get());