aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gpu/GrGpu.cpp2
-rw-r--r--src/gpu/GrResourceProvider.cpp8
-rw-r--r--src/gpu/GrResourceProvider.h9
-rw-r--r--src/gpu/GrSemaphore.h20
-rw-r--r--src/gpu/gl/GrGLSemaphore.h9
-rw-r--r--src/gpu/vk/GrVkSemaphore.cpp7
-rw-r--r--src/gpu/vk/GrVkSemaphore.h4
7 files changed, 18 insertions, 41 deletions
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index ca0749649b..70ec772685 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -348,7 +348,7 @@ GrSemaphoresSubmitted GrGpu::finishFlush(int numSemaphores,
this->insertSemaphore(semaphore, false);
if (!backendSemaphores[i].isInitialized()) {
- semaphore->setBackendSemaphore(&backendSemaphores[i]);
+ backendSemaphores[i] = semaphore->backendSemaphore();
}
}
}
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 11843b396b..12bc5ab1f4 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -444,11 +444,3 @@ sk_sp<GrSemaphore> GrResourceProvider::wrapBackendSemaphore(const GrBackendSemap
wrapType,
ownership);
}
-
-void GrResourceProvider::takeOwnershipOfSemaphore(sk_sp<GrSemaphore> semaphore) {
- semaphore->resetGpu(fGpu);
-}
-
-void GrResourceProvider::releaseOwnershipOfSemaphore(sk_sp<GrSemaphore> semaphore) {
- semaphore->resetGpu(nullptr);
-}
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index 347a5de2cd..d1c6aa38fe 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -237,15 +237,6 @@ public:
SemaphoreWrapType wrapType,
GrWrapOwnership = kBorrow_GrWrapOwnership);
- // Takes the GrSemaphore and sets the ownership of the semaphore to the GrGpu object used by
- // this class. This call is only used when passing a GrSemaphore from one context to another.
- void takeOwnershipOfSemaphore(sk_sp<GrSemaphore>);
- // Takes the GrSemaphore and resets the ownership of the semaphore so that it is not owned by
- // any GrGpu. A follow up call to takeOwnershipofSemaphore must be made so that the underlying
- // semaphore can be deleted. This call is only used when passing a GrSemaphore from one context
- // to another.
- void releaseOwnershipOfSemaphore(sk_sp<GrSemaphore>);
-
void abandon() {
fCache = nullptr;
fGpu = nullptr;
diff --git a/src/gpu/GrSemaphore.h b/src/gpu/GrSemaphore.h
index fbc5a6df56..bdaf80571c 100644
--- a/src/gpu/GrSemaphore.h
+++ b/src/gpu/GrSemaphore.h
@@ -8,31 +8,21 @@
#ifndef GrSemaphore_DEFINED
#define GrSemaphore_DEFINED
+#include "GrBackendSemaphore.h"
#include "SkRefCnt.h"
-class GrBackendSemaphore;
class GrGpu;
class GrSemaphore : public SkRefCnt {
-private:
- // This function should only be used in the case of exporting and importing a GrSemaphore object
- // from one GrContext to another. When exporting, the GrSemaphore should be set to a null GrGpu,
- // and when importing it should be set to the GrGpu of the current context. Once exported, a
- // GrSemaphore should not be used with its old context.
- void resetGpu(const GrGpu* gpu) { fGpu = gpu; }
-
- // The derived class will init the GrBackendSemaphore. This is used when flushing with signal
- // semaphores so we can set the clients GrBackendSemaphore object after we've created the
+public:
+ // The derived class can return its GrBackendSemaphore. This is used when flushing with signal
+ // semaphores so we can set the client's GrBackendSemaphore object after we've created the
// internal semaphore.
- virtual void setBackendSemaphore(GrBackendSemaphore*) const = 0;
+ virtual GrBackendSemaphore backendSemaphore() const = 0;
protected:
explicit GrSemaphore(const GrGpu* gpu) : fGpu(gpu) {}
- friend class GrGpu; // setBackendSemaphore
- friend class GrRenderTargetContext; // setBackendSemaphore
- friend class GrResourceProvider; // resetGpu
-
const GrGpu* fGpu;
};
diff --git a/src/gpu/gl/GrGLSemaphore.h b/src/gpu/gl/GrGLSemaphore.h
index b48ce78bf1..6fd1a6fb01 100644
--- a/src/gpu/gl/GrGLSemaphore.h
+++ b/src/gpu/gl/GrGLSemaphore.h
@@ -34,12 +34,15 @@ public:
GrGLsync sync() const { return fSync; }
void setSync(const GrGLsync& sync) { fSync = sync; }
+ GrBackendSemaphore backendSemaphore() const override {
+ GrBackendSemaphore backendSemaphore;
+ backendSemaphore.initGL(fSync);
+ return backendSemaphore;
+ }
+
private:
GrGLSemaphore(const GrGLGpu* gpu, bool isOwned);
- void setBackendSemaphore(GrBackendSemaphore* backendSemaphore) const override {
- backendSemaphore->initGL(fSync);
- }
GrGLsync fSync;
bool fIsOwned;
diff --git a/src/gpu/vk/GrVkSemaphore.cpp b/src/gpu/vk/GrVkSemaphore.cpp
index c794f7a818..7a5639156a 100644
--- a/src/gpu/vk/GrVkSemaphore.cpp
+++ b/src/gpu/vk/GrVkSemaphore.cpp
@@ -63,7 +63,8 @@ void GrVkSemaphore::Resource::freeGPUData(const GrVkGpu* gpu) const {
}
}
-void GrVkSemaphore::setBackendSemaphore(GrBackendSemaphore* backendSemaphore) const {
- backendSemaphore->initVulkan(fResource->semaphore());
+GrBackendSemaphore GrVkSemaphore::backendSemaphore() const {
+ GrBackendSemaphore backendSemaphore;
+ backendSemaphore.initVulkan(fResource->semaphore());
+ return backendSemaphore;
}
-
diff --git a/src/gpu/vk/GrVkSemaphore.h b/src/gpu/vk/GrVkSemaphore.h
index 8f39e1785e..58e50809f8 100644
--- a/src/gpu/vk/GrVkSemaphore.h
+++ b/src/gpu/vk/GrVkSemaphore.h
@@ -31,6 +31,8 @@ public:
~GrVkSemaphore() override;
+ GrBackendSemaphore backendSemaphore() const override;
+
class Resource : public GrVkResource {
public:
Resource(VkSemaphore semaphore, bool prohibitSignal, bool prohibitWait, bool isOwned)
@@ -90,8 +92,6 @@ private:
GrVkSemaphore(const GrVkGpu* gpu, VkSemaphore semaphore, bool prohibitSignal, bool prohibitWait,
bool isOwned);
- void setBackendSemaphore(GrBackendSemaphore*) const override;
-
Resource* fResource;
typedef GrSemaphore INHERITED;