Reland "Remove deprecated flush calls."

This reverts commit 5e6d789ce4.

Reason for revert: Relanding with fix landed in chrome

Original change's description:
> Revert "Remove deprecated flush calls."
> 
> This reverts commit d8fd0bf574.
> 
> Reason for revert: chrome roll
> 
> Original change's description:
> > Remove deprecated flush calls.
> > 
> > Bug: skia:10118
> > Change-Id: I13758b5416784c296b8b5be9f3228230ac1be05f
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290540
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> 
> TBR=egdaniel@google.com,bsalomon@google.com
> 
> Change-Id: I49d35cdb258e632f645974c5ec62075d3392efe0
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10118
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290834
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

TBR=egdaniel@google.com,bsalomon@google.com

# Not skipping CQ checks because this is a reland.

Bug: skia:10118
Change-Id: Ie24d7845a4ad75f95afe59037ea80a9f38082f13
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290918
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2020-05-19 18:06:26 -04:00 committed by Skia Commit-Bot
parent 287d5984fb
commit 49de1031d4
10 changed files with 13 additions and 96 deletions

View File

@ -9,6 +9,9 @@ Milestone 85
* <insert new release notes here>
* Remove deprecated version of flush calls on GrContext and SkSurface.
https://review.skia.org/2290540
* SkCanvas::drawVertices and drawPatch now support mapping an SkShader without explicit
texture coordinates. If they're not supplied, the local positions (vertex position or
patch cubic positions) will be directly used to sample the SkShader.

View File

@ -67,7 +67,7 @@ static void draw_example(SkSurface* surface, const SkPaint& paint, double rotati
draw_example(surface.get(), fPaint, rotation);
// Must flush *and* present for this to work!
surface->flush();
surface->flushAndSubmit();
surface = nullptr;
id<MTLCommandBuffer> commandBuffer = [[self metalQueue] commandBuffer];

View File

@ -498,7 +498,7 @@ EMSCRIPTEN_BINDINGS(my_module) {
.smart_ptr<sk_sp<SkSurface>>("sk_sp<SkSurface>")
.function("width", &SkSurface::width)
.function("height", &SkSurface::height)
.function("_flush", select_overload<void()>(&SkSurface::flush))
.function("_flush", select_overload<void()>(&SkSurface::flushAndSubmit))
.function("getCanvas", &SkSurface::getCanvas, allow_raw_pointers());
class_<SkCanvas>("SkCanvas")
.function("clear", optional_override([](SkCanvas& self, JSColor color)->void {

View File

@ -920,11 +920,6 @@ public:
*/
void flushAndSubmit();
/**
* Deprecated.
*/
void flush() { this->flushAndSubmit(); }
enum class BackendSurfaceAccess {
kNoAccess, //!< back-end object will not be used by client
kPresent, //!< back-end surface will be used for presenting to screen
@ -961,28 +956,6 @@ public:
*/
GrSemaphoresSubmitted flush(BackendSurfaceAccess access, const GrFlushInfo& info);
/** Deprecated
*/
GrSemaphoresSubmitted flush(BackendSurfaceAccess access, GrFlushFlags flags,
int numSemaphores, GrBackendSemaphore signalSemaphores[],
GrGpuFinishedProc finishedProc = nullptr,
GrGpuFinishedContext finishedContext = nullptr);
/** The below enum and flush call are deprecated
*/
enum FlushFlags {
kNone_FlushFlags = 0,
// flush will wait till all submitted GPU work is finished before returning.
kSyncCpu_FlushFlag = 0x1,
};
GrSemaphoresSubmitted flush(BackendSurfaceAccess access, FlushFlags flags,
int numSemaphores, GrBackendSemaphore signalSemaphores[]);
/** Deprecated.
*/
GrSemaphoresSubmitted flushAndSignalSemaphores(int numSemaphores,
GrBackendSemaphore signalSemaphores[]);
/** Inserts a list of GPU semaphores that the current GPU-backed API must wait on before
executing any more commands on the GPU for this surface. Skia will take ownership of the
underlying semaphores and delete them once they have been signaled and waited on.

View File

@ -311,11 +311,6 @@ public:
*/
void flushAndSubmit() { this->flush(GrFlushInfo(), GrPrepareForExternalIORequests()); }
/**
* Deprecated.
*/
void flush() { this->flushAndSubmit(); }
/**
* Call to ensure all drawing to the context has been issued to the underlying 3D API.
*
@ -352,33 +347,6 @@ public:
*/
GrSemaphoresSubmitted flush(const GrFlushInfo&, const GrPrepareForExternalIORequests&);
/**
* Deprecated.
*/
GrSemaphoresSubmitted flush(GrFlushFlags flags, int numSemaphores,
GrBackendSemaphore signalSemaphores[],
GrGpuFinishedProc finishedProc = nullptr,
GrGpuFinishedContext finishedContext = nullptr) {
GrFlushInfo info;
info.fFlags = flags;
info.fNumSemaphores = numSemaphores;
info.fSignalSemaphores = signalSemaphores;
info.fFinishedProc = finishedProc;
info.fFinishedContext = finishedContext;
return this->flush(info);
}
/**
* Deprecated.
*/
GrSemaphoresSubmitted flushAndSignalSemaphores(int numSemaphores,
GrBackendSemaphore signalSemaphores[]) {
GrFlushInfo info;
info.fNumSemaphores = numSemaphores;
info.fSignalSemaphores = signalSemaphores;
return this->flush(info);
}
/**
* Placeholder no-op submit call.
*/

View File

@ -1455,7 +1455,7 @@ EMSCRIPTEN_BINDINGS(Skia) {
class_<SkSurface>("SkSurface")
.smart_ptr<sk_sp<SkSurface>>("sk_sp<SkSurface>")
.function("_flush", select_overload<void()>(&SkSurface::flush))
.function("_flush", select_overload<void()>(&SkSurface::flushAndSubmit))
.function("getCanvas", &SkSurface::getCanvas, allow_raw_pointers())
.function("height", &SkSurface::height)
.function("makeImageSnapshot", select_overload<sk_sp<SkImage>()>(&SkSurface::makeImageSnapshot))

View File

@ -452,37 +452,6 @@ GrSemaphoresSubmitted SkSurface::flush(BackendSurfaceAccess access, const GrFlus
return asSB(this)->onFlush(access, flushInfo);
}
GrSemaphoresSubmitted SkSurface::flush(BackendSurfaceAccess access, GrFlushFlags flags,
int numSemaphores, GrBackendSemaphore signalSemaphores[],
GrGpuFinishedProc finishedProc,
GrGpuFinishedContext finishedContext) {
GrFlushInfo info;
info.fFlags = flags;
info.fNumSemaphores = numSemaphores;
info.fSignalSemaphores = signalSemaphores;
info.fFinishedProc = finishedProc;
info.fFinishedContext = finishedContext;
return this->flush(access, info);
}
GrSemaphoresSubmitted SkSurface::flush(BackendSurfaceAccess access, FlushFlags flags,
int numSemaphores, GrBackendSemaphore signalSemaphores[]) {
GrFlushFlags grFlags = flags == kSyncCpu_FlushFlag ? kSyncCpu_GrFlushFlag : kNone_GrFlushFlags;
GrFlushInfo info;
info.fFlags = grFlags;
info.fNumSemaphores = numSemaphores;
info.fSignalSemaphores = signalSemaphores;
return this->flush(access, info);
}
GrSemaphoresSubmitted SkSurface::flushAndSignalSemaphores(int numSemaphores,
GrBackendSemaphore signalSemaphores[]) {
GrFlushInfo info;
info.fNumSemaphores = numSemaphores;
info.fSignalSemaphores = signalSemaphores;
return this->flush(BackendSurfaceAccess::kNoAccess, info);
}
bool SkSurface::wait(int numSemaphores, const GrBackendSemaphore* waitSemaphores) {
return asSB(this)->onWait(numSemaphores, waitSemaphores);
}

View File

@ -242,7 +242,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EmptySurfaceSemaphoreTest, reporter, ctxInfo)
mainSurface->flushAndSubmit();
GrBackendSemaphore semaphore;
GrSemaphoresSubmitted submitted = mainSurface->flushAndSignalSemaphores(1, &semaphore);
GrFlushInfo flushInfo;
flushInfo.fNumSemaphores = 1;
flushInfo.fSignalSemaphores = &semaphore;
GrSemaphoresSubmitted submitted = mainSurface->flush(SkSurface::BackendSurfaceAccess::kNoAccess,
flushInfo);
REPORTER_ASSERT(reporter, GrSemaphoresSubmitted::kYes == submitted);
#ifdef SK_GL

View File

@ -87,7 +87,7 @@ static sk_sp<SkSurface> make_gl_surface(GrContext* grContext, int width, int hei
[viewController draw:rect
toCanvas:(surface->getCanvas())
atSize:CGSize{(CGFloat)width, (CGFloat)height}];
surface->flush();
surface->flushAndSubmit();
}
if (next) {
[NSTimer scheduledTimerWithTimeInterval:std::max(0.0, next - SkTime::GetNSecs() * 1e-9)

View File

@ -55,7 +55,7 @@
return;
}
[viewController draw:rect toCanvas:surface->getCanvas() atSize:size];
surface->flush();
surface->flushAndSubmit();
surface = nullptr;
id<MTLCommandBuffer> commandBuffer = [fQueue commandBuffer];