When flushing a surface with semaphores, have last semaphore op call glFlush

Bug: skia:6770
Change-Id: Ia321b3826da87bd0d25ca2b13b7360baa8caf597
Reviewed-on: https://skia-review.googlesource.com/20453
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2017-06-21 16:09:50 -04:00 committed by Skia Commit-Bot
parent ceb7a42649
commit a2cebd8330
4 changed files with 19 additions and 15 deletions

View File

@ -1446,8 +1446,11 @@ bool GrRenderTargetContext::prepareForExternalIO(int numSemaphores,
SkTArray<sk_sp<GrSemaphore>> semaphores(numSemaphores);
for (int i = 0; i < numSemaphores; ++i) {
semaphores.push_back(fContext->resourceProvider()->makeSemaphore(false));
// Create signal semaphore ops and force the final one to call flush.
bool forceFlush = (i == (numSemaphores - 1));
std::unique_ptr<GrOp> signalOp(GrSemaphoreOp::MakeSignal(semaphores.back(),
fRenderTargetProxy.get()));
fRenderTargetProxy.get(),
forceFlush));
this->getOpList()->addOp(std::move(signalOp), *this->caps());
}

View File

@ -615,12 +615,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
} else if (version >= GR_GL_VER(3, 0)) {
fFenceSyncSupport = true;
}
#ifdef SK_BUILD_FOR_MAC
if (kIntel_GrGLVendor == ctxInfo.vendor()) {
// See skia:6770
fFenceSyncSupport = false;
}
#endif
// Safely moving textures between contexts requires fences.
fCrossContextTextureSupport = fFenceSyncSupport;

View File

@ -15,21 +15,26 @@ public:
DEFINE_OP_CLASS_ID
static std::unique_ptr<GrSignalSemaphoreOp> Make(sk_sp<GrSemaphore> semaphore,
GrRenderTargetProxy* proxy) {
GrRenderTargetProxy* proxy,
bool forceFlush) {
return std::unique_ptr<GrSignalSemaphoreOp>(new GrSignalSemaphoreOp(std::move(semaphore),
proxy));
proxy,
forceFlush));
}
const char* name() const override { return "SignalSemaphore"; }
private:
explicit GrSignalSemaphoreOp(sk_sp<GrSemaphore> semaphore, GrRenderTargetProxy* proxy)
: INHERITED(ClassID(), std::move(semaphore), proxy) {}
explicit GrSignalSemaphoreOp(sk_sp<GrSemaphore> semaphore, GrRenderTargetProxy* proxy,
bool forceFlush)
: INHERITED(ClassID(), std::move(semaphore), proxy), fForceFlush(forceFlush) {}
void onExecute(GrOpFlushState* state) override {
state->gpu()->insertSemaphore(fSemaphore);
state->gpu()->insertSemaphore(fSemaphore, fForceFlush);
}
bool fForceFlush;
typedef GrSemaphoreOp INHERITED;
};
@ -59,8 +64,9 @@ private:
////////////////////////////////////////////////////////////////////////////////
std::unique_ptr<GrSemaphoreOp> GrSemaphoreOp::MakeSignal(sk_sp<GrSemaphore> semaphore,
GrRenderTargetProxy* proxy) {
return GrSignalSemaphoreOp::Make(std::move(semaphore), proxy);
GrRenderTargetProxy* proxy,
bool forceFlush) {
return GrSignalSemaphoreOp::Make(std::move(semaphore), proxy, forceFlush);
}
std::unique_ptr<GrSemaphoreOp> GrSemaphoreOp::MakeWait(sk_sp<GrSemaphore> semaphore,

View File

@ -17,7 +17,8 @@
class GrSemaphoreOp : public GrOp {
public:
static std::unique_ptr<GrSemaphoreOp> MakeSignal(sk_sp<GrSemaphore> semaphore,
GrRenderTargetProxy* proxy);
GrRenderTargetProxy* proxy,
bool forceFlush);
static std::unique_ptr<GrSemaphoreOp> MakeWait(sk_sp<GrSemaphore> semaphore,
GrRenderTargetProxy* proxy);