Remove unused GrSignalSemaphoreOp and forced flushed on semaphore insertion.

Bug: skia:
Change-Id: Iad0e6468552606d7528aaf0307948fe84f85a0d8
Reviewed-on: https://skia-review.googlesource.com/c/175256
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2018-12-06 11:11:37 -05:00 committed by Skia Commit-Bot
parent f0b6044d6d
commit 858e12ca11
10 changed files with 11 additions and 60 deletions

View File

@ -369,7 +369,7 @@ GrSemaphoresSubmitted GrGpu::finishFlush(int numSemaphores,
} else { } else {
semaphore = resourceProvider->makeSemaphore(false); semaphore = resourceProvider->makeSemaphore(false);
} }
this->insertSemaphore(semaphore, false); this->insertSemaphore(semaphore);
if (!backendSemaphores[i].isInitialized()) { if (!backendSemaphores[i].isInitialized()) {
backendSemaphores[i] = semaphore->backendSemaphore(); backendSemaphores[i] = semaphore->backendSemaphore();

View File

@ -267,7 +267,7 @@ public:
virtual sk_sp<GrSemaphore> wrapBackendSemaphore(const GrBackendSemaphore& semaphore, virtual sk_sp<GrSemaphore> wrapBackendSemaphore(const GrBackendSemaphore& semaphore,
GrResourceProvider::SemaphoreWrapType wrapType, GrResourceProvider::SemaphoreWrapType wrapType,
GrWrapOwnership ownership) = 0; GrWrapOwnership ownership) = 0;
virtual void insertSemaphore(sk_sp<GrSemaphore> semaphore, bool flush = false) = 0; virtual void insertSemaphore(sk_sp<GrSemaphore> semaphore) = 0;
virtual void waitSemaphore(sk_sp<GrSemaphore> semaphore) = 0; virtual void waitSemaphore(sk_sp<GrSemaphore> semaphore) = 0;
/** /**

View File

@ -4333,16 +4333,12 @@ sk_sp<GrSemaphore> GrGLGpu::wrapBackendSemaphore(const GrBackendSemaphore& semap
return GrGLSemaphore::MakeWrapped(this, semaphore.glSync(), ownership); return GrGLSemaphore::MakeWrapped(this, semaphore.glSync(), ownership);
} }
void GrGLGpu::insertSemaphore(sk_sp<GrSemaphore> semaphore, bool flush) { void GrGLGpu::insertSemaphore(sk_sp<GrSemaphore> semaphore) {
GrGLSemaphore* glSem = static_cast<GrGLSemaphore*>(semaphore.get()); GrGLSemaphore* glSem = static_cast<GrGLSemaphore*>(semaphore.get());
GrGLsync sync; GrGLsync sync;
GL_CALL_RET(sync, FenceSync(GR_GL_SYNC_GPU_COMMANDS_COMPLETE, 0)); GL_CALL_RET(sync, FenceSync(GR_GL_SYNC_GPU_COMMANDS_COMPLETE, 0));
glSem->setSync(sync); glSem->setSync(sync);
if (flush) {
GL_CALL(Flush());
}
} }
void GrGLGpu::waitSemaphore(sk_sp<GrSemaphore> semaphore) { void GrGLGpu::waitSemaphore(sk_sp<GrSemaphore> semaphore) {
@ -4362,7 +4358,9 @@ void GrGLGpu::insertEventMarker(const char* msg) {
sk_sp<GrSemaphore> GrGLGpu::prepareTextureForCrossContextUsage(GrTexture* texture) { sk_sp<GrSemaphore> GrGLGpu::prepareTextureForCrossContextUsage(GrTexture* texture) {
// Set up a semaphore to be signaled once the data is ready, and flush GL // Set up a semaphore to be signaled once the data is ready, and flush GL
sk_sp<GrSemaphore> semaphore = this->makeSemaphore(true); sk_sp<GrSemaphore> semaphore = this->makeSemaphore(true);
this->insertSemaphore(semaphore, true); this->insertSemaphore(semaphore);
// We must call flush here to make sure the GrGLSync object gets created and sent to the gpu.
GL_CALL(Flush());
return semaphore; return semaphore;
} }

View File

@ -163,7 +163,7 @@ public:
sk_sp<GrSemaphore> wrapBackendSemaphore(const GrBackendSemaphore& semaphore, sk_sp<GrSemaphore> wrapBackendSemaphore(const GrBackendSemaphore& semaphore,
GrResourceProvider::SemaphoreWrapType wrapType, GrResourceProvider::SemaphoreWrapType wrapType,
GrWrapOwnership ownership) override; GrWrapOwnership ownership) override;
void insertSemaphore(sk_sp<GrSemaphore> semaphore, bool flush) override; void insertSemaphore(sk_sp<GrSemaphore> semaphore) override;
void waitSemaphore(sk_sp<GrSemaphore> semaphore) override; void waitSemaphore(sk_sp<GrSemaphore> semaphore) override;
sk_sp<GrSemaphore> prepareTextureForCrossContextUsage(GrTexture*) override; sk_sp<GrSemaphore> prepareTextureForCrossContextUsage(GrTexture*) override;

View File

@ -41,7 +41,7 @@ public:
sk_sp<GrSemaphore> wrapBackendSemaphore(const GrBackendSemaphore& semaphore, sk_sp<GrSemaphore> wrapBackendSemaphore(const GrBackendSemaphore& semaphore,
GrResourceProvider::SemaphoreWrapType wrapType, GrResourceProvider::SemaphoreWrapType wrapType,
GrWrapOwnership ownership) override { return nullptr; } GrWrapOwnership ownership) override { return nullptr; }
void insertSemaphore(sk_sp<GrSemaphore> semaphore, bool flush) override {} void insertSemaphore(sk_sp<GrSemaphore> semaphore) override {}
void waitSemaphore(sk_sp<GrSemaphore> semaphore) override {} void waitSemaphore(sk_sp<GrSemaphore> semaphore) override {}
sk_sp<GrSemaphore> prepareTextureForCrossContextUsage(GrTexture*) override { return nullptr; } sk_sp<GrSemaphore> prepareTextureForCrossContextUsage(GrTexture*) override { return nullptr; }

View File

@ -108,7 +108,7 @@ public:
sk_sp<GrSemaphore> wrapBackendSemaphore(const GrBackendSemaphore& semaphore, sk_sp<GrSemaphore> wrapBackendSemaphore(const GrBackendSemaphore& semaphore,
GrResourceProvider::SemaphoreWrapType wrapType, GrResourceProvider::SemaphoreWrapType wrapType,
GrWrapOwnership ownership) override { return nullptr; } GrWrapOwnership ownership) override { return nullptr; }
void insertSemaphore(sk_sp<GrSemaphore> semaphore, bool flush) override {} void insertSemaphore(sk_sp<GrSemaphore> semaphore) override {}
void waitSemaphore(sk_sp<GrSemaphore> semaphore) override {} void waitSemaphore(sk_sp<GrSemaphore> semaphore) override {}
sk_sp<GrSemaphore> prepareTextureForCrossContextUsage(GrTexture*) override { return nullptr; } sk_sp<GrSemaphore> prepareTextureForCrossContextUsage(GrTexture*) override { return nullptr; }

View File

@ -13,37 +13,6 @@
#include "GrMemoryPool.h" #include "GrMemoryPool.h"
#include "GrOpFlushState.h" #include "GrOpFlushState.h"
class GrSignalSemaphoreOp final : public GrSemaphoreOp {
public:
DEFINE_OP_CLASS_ID
static std::unique_ptr<GrOp> Make(GrContext* context,
sk_sp<GrSemaphore> semaphore,
GrRenderTargetProxy* proxy,
bool forceFlush) {
GrOpMemoryPool* pool = context->contextPriv().opMemoryPool();
return pool->allocate<GrSignalSemaphoreOp>(std::move(semaphore), proxy, forceFlush);
}
const char* name() const override { return "SignalSemaphore"; }
private:
friend class GrOpMemoryPool; // for ctor
explicit GrSignalSemaphoreOp(sk_sp<GrSemaphore> semaphore, GrRenderTargetProxy* proxy,
bool forceFlush)
: INHERITED(ClassID(), std::move(semaphore), proxy), fForceFlush(forceFlush) {}
void onExecute(GrOpFlushState* state, const SkRect& chainBounds) override {
state->gpu()->insertSemaphore(fSemaphore, fForceFlush);
}
bool fForceFlush;
typedef GrSemaphoreOp INHERITED;
};
class GrWaitSemaphoreOp final : public GrSemaphoreOp { class GrWaitSemaphoreOp final : public GrSemaphoreOp {
public: public:
DEFINE_OP_CLASS_ID DEFINE_OP_CLASS_ID
@ -73,13 +42,6 @@ private:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
std::unique_ptr<GrOp> GrSemaphoreOp::MakeSignal(GrContext* context,
sk_sp<GrSemaphore> semaphore,
GrRenderTargetProxy* proxy,
bool forceFlush) {
return GrSignalSemaphoreOp::Make(context, std::move(semaphore), proxy, forceFlush);
}
std::unique_ptr<GrOp> GrSemaphoreOp::MakeWait(GrContext* context, std::unique_ptr<GrOp> GrSemaphoreOp::MakeWait(GrContext* context,
sk_sp<GrSemaphore> semaphore, sk_sp<GrSemaphore> semaphore,
GrRenderTargetProxy* proxy) { GrRenderTargetProxy* proxy) {

View File

@ -16,11 +16,6 @@
class GrSemaphoreOp : public GrOp { class GrSemaphoreOp : public GrOp {
public: public:
static std::unique_ptr<GrOp> MakeSignal(GrContext*,
sk_sp<GrSemaphore>,
GrRenderTargetProxy*,
bool forceFlush);
static std::unique_ptr<GrOp> MakeWait(GrContext*, static std::unique_ptr<GrOp> MakeWait(GrContext*,
sk_sp<GrSemaphore>, sk_sp<GrSemaphore>,
GrRenderTargetProxy*); GrRenderTargetProxy*);

View File

@ -2112,7 +2112,7 @@ sk_sp<GrSemaphore> GrVkGpu::wrapBackendSemaphore(const GrBackendSemaphore& semap
return GrVkSemaphore::MakeWrapped(this, semaphore.vkSemaphore(), wrapType, ownership); return GrVkSemaphore::MakeWrapped(this, semaphore.vkSemaphore(), wrapType, ownership);
} }
void GrVkGpu::insertSemaphore(sk_sp<GrSemaphore> semaphore, bool flush) { void GrVkGpu::insertSemaphore(sk_sp<GrSemaphore> semaphore) {
GrVkSemaphore* vkSem = static_cast<GrVkSemaphore*>(semaphore.get()); GrVkSemaphore* vkSem = static_cast<GrVkSemaphore*>(semaphore.get());
GrVkSemaphore::Resource* resource = vkSem->getResource(); GrVkSemaphore::Resource* resource = vkSem->getResource();
@ -2120,10 +2120,6 @@ void GrVkGpu::insertSemaphore(sk_sp<GrSemaphore> semaphore, bool flush) {
resource->ref(); resource->ref();
fSemaphoresToSignal.push_back(resource); fSemaphoresToSignal.push_back(resource);
} }
if (flush) {
this->submitCommandBuffer(kSkip_SyncQueue);
}
} }
void GrVkGpu::waitSemaphore(sk_sp<GrSemaphore> semaphore) { void GrVkGpu::waitSemaphore(sk_sp<GrSemaphore> semaphore) {

View File

@ -146,7 +146,7 @@ public:
sk_sp<GrSemaphore> wrapBackendSemaphore(const GrBackendSemaphore& semaphore, sk_sp<GrSemaphore> wrapBackendSemaphore(const GrBackendSemaphore& semaphore,
GrResourceProvider::SemaphoreWrapType wrapType, GrResourceProvider::SemaphoreWrapType wrapType,
GrWrapOwnership ownership) override; GrWrapOwnership ownership) override;
void insertSemaphore(sk_sp<GrSemaphore> semaphore, bool flush) override; void insertSemaphore(sk_sp<GrSemaphore> semaphore) override;
void waitSemaphore(sk_sp<GrSemaphore> semaphore) override; void waitSemaphore(sk_sp<GrSemaphore> semaphore) override;
// These match the definitions in SkDrawable, from whence they came // These match the definitions in SkDrawable, from whence they came