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:
parent
ceb7a42649
commit
a2cebd8330
@ -1446,8 +1446,11 @@ bool GrRenderTargetContext::prepareForExternalIO(int numSemaphores,
|
|||||||
SkTArray<sk_sp<GrSemaphore>> semaphores(numSemaphores);
|
SkTArray<sk_sp<GrSemaphore>> semaphores(numSemaphores);
|
||||||
for (int i = 0; i < numSemaphores; ++i) {
|
for (int i = 0; i < numSemaphores; ++i) {
|
||||||
semaphores.push_back(fContext->resourceProvider()->makeSemaphore(false));
|
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(),
|
std::unique_ptr<GrOp> signalOp(GrSemaphoreOp::MakeSignal(semaphores.back(),
|
||||||
fRenderTargetProxy.get()));
|
fRenderTargetProxy.get(),
|
||||||
|
forceFlush));
|
||||||
this->getOpList()->addOp(std::move(signalOp), *this->caps());
|
this->getOpList()->addOp(std::move(signalOp), *this->caps());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -615,12 +615,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
|
|||||||
} else if (version >= GR_GL_VER(3, 0)) {
|
} else if (version >= GR_GL_VER(3, 0)) {
|
||||||
fFenceSyncSupport = true;
|
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.
|
// Safely moving textures between contexts requires fences.
|
||||||
fCrossContextTextureSupport = fFenceSyncSupport;
|
fCrossContextTextureSupport = fFenceSyncSupport;
|
||||||
|
@ -15,21 +15,26 @@ public:
|
|||||||
DEFINE_OP_CLASS_ID
|
DEFINE_OP_CLASS_ID
|
||||||
|
|
||||||
static std::unique_ptr<GrSignalSemaphoreOp> Make(sk_sp<GrSemaphore> semaphore,
|
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),
|
return std::unique_ptr<GrSignalSemaphoreOp>(new GrSignalSemaphoreOp(std::move(semaphore),
|
||||||
proxy));
|
proxy,
|
||||||
|
forceFlush));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* name() const override { return "SignalSemaphore"; }
|
const char* name() const override { return "SignalSemaphore"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit GrSignalSemaphoreOp(sk_sp<GrSemaphore> semaphore, GrRenderTargetProxy* proxy)
|
explicit GrSignalSemaphoreOp(sk_sp<GrSemaphore> semaphore, GrRenderTargetProxy* proxy,
|
||||||
: INHERITED(ClassID(), std::move(semaphore), proxy) {}
|
bool forceFlush)
|
||||||
|
: INHERITED(ClassID(), std::move(semaphore), proxy), fForceFlush(forceFlush) {}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* state) override {
|
void onExecute(GrOpFlushState* state) override {
|
||||||
state->gpu()->insertSemaphore(fSemaphore);
|
state->gpu()->insertSemaphore(fSemaphore, fForceFlush);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool fForceFlush;
|
||||||
|
|
||||||
typedef GrSemaphoreOp INHERITED;
|
typedef GrSemaphoreOp INHERITED;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -59,8 +64,9 @@ private:
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
std::unique_ptr<GrSemaphoreOp> GrSemaphoreOp::MakeSignal(sk_sp<GrSemaphore> semaphore,
|
std::unique_ptr<GrSemaphoreOp> GrSemaphoreOp::MakeSignal(sk_sp<GrSemaphore> semaphore,
|
||||||
GrRenderTargetProxy* proxy) {
|
GrRenderTargetProxy* proxy,
|
||||||
return GrSignalSemaphoreOp::Make(std::move(semaphore), proxy);
|
bool forceFlush) {
|
||||||
|
return GrSignalSemaphoreOp::Make(std::move(semaphore), proxy, forceFlush);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<GrSemaphoreOp> GrSemaphoreOp::MakeWait(sk_sp<GrSemaphore> semaphore,
|
std::unique_ptr<GrSemaphoreOp> GrSemaphoreOp::MakeWait(sk_sp<GrSemaphore> semaphore,
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
class GrSemaphoreOp : public GrOp {
|
class GrSemaphoreOp : public GrOp {
|
||||||
public:
|
public:
|
||||||
static std::unique_ptr<GrSemaphoreOp> MakeSignal(sk_sp<GrSemaphore> semaphore,
|
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,
|
static std::unique_ptr<GrSemaphoreOp> MakeWait(sk_sp<GrSemaphore> semaphore,
|
||||||
GrRenderTargetProxy* proxy);
|
GrRenderTargetProxy* proxy);
|
||||||
|
Loading…
Reference in New Issue
Block a user