Revert "Revert "Add API for flushing surfaces with gpu semaphores""
This reverts commit 7292231905c34ed290ba479338f26b56ae2a7792.
This change relands the original plus the follow on change:
https://skia-review.googlesource.com/20059.
Additionally it adds a blacklist for the mac intel bots which
don't see to respect the added fences on the GPU.
Original change's description:
> Revert "Add API for flushing surfaces with gpu semaphores"
>
> This reverts commit 66366c697853e906d961ae691e2bc5209cdcfa62.
>
> Reason for revert: Failing test on mac bots
>
> Original change's description:
> > Add API for flushing surfaces with gpu semaphores
> >
> > BUG=skia:
> >
> > Change-Id: Ia4bfef784cd5f2516ceccafce958be18a86f91d1
> > Reviewed-on: https://skia-review.googlesource.com/11488
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Forrest Reiling <freiling@google.com>
>
> TBR=egdaniel@google.com,jvanverth@google.com,bsalomon@google.com,brianosman@google.com,freiling@google.com
>
> Change-Id: I75633a2732d2d48b1926f9ad818a9f1a9196d211
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/20063
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,jvanverth@google.com,bsalomon@google.com,brianosman@google.com,freiling@google.com
Change-Id: I4dc6c0e1deb0398eeb165a34f0a26af7a58259f1
Reviewed-on: https://skia-review.googlesource.com/20141
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/vk/GrVkSemaphore.cpp b/src/gpu/vk/GrVkSemaphore.cpp
index d84635f..d201458 100644
--- a/src/gpu/vk/GrVkSemaphore.cpp
+++ b/src/gpu/vk/GrVkSemaphore.cpp
@@ -7,6 +7,7 @@
#include "GrVkSemaphore.h"
+#include "GrBackendSemaphore.h"
#include "GrVkGpu.h"
#include "GrVkUtil.h"
@@ -15,7 +16,7 @@
#undef CreateSemaphore
#endif
-sk_sp<GrVkSemaphore> GrVkSemaphore::Make(const GrVkGpu* gpu) {
+sk_sp<GrVkSemaphore> GrVkSemaphore::Make(const GrVkGpu* gpu, bool isOwned) {
VkSemaphoreCreateInfo createInfo;
memset(&createInfo, 0, sizeof(VkFenceCreateInfo));
createInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
@@ -25,11 +26,22 @@
GR_VK_CALL_ERRCHECK(gpu->vkInterface(),
CreateSemaphore(gpu->device(), &createInfo, nullptr, &semaphore));
- return sk_sp<GrVkSemaphore>(new GrVkSemaphore(gpu, semaphore));
+ return sk_sp<GrVkSemaphore>(new GrVkSemaphore(gpu, semaphore, isOwned));
}
-GrVkSemaphore::GrVkSemaphore(const GrVkGpu* gpu, VkSemaphore semaphore) : INHERITED(gpu) {
- fResource = new Resource(semaphore);
+sk_sp<GrVkSemaphore> GrVkSemaphore::MakeWrapped(const GrVkGpu* gpu,
+ VkSemaphore semaphore,
+ GrWrapOwnership ownership) {
+ if (VK_NULL_HANDLE == semaphore) {
+ return nullptr;
+ }
+ return sk_sp<GrVkSemaphore>(new GrVkSemaphore(gpu, semaphore,
+ kBorrow_GrWrapOwnership != ownership));
+}
+
+GrVkSemaphore::GrVkSemaphore(const GrVkGpu* gpu, VkSemaphore semaphore, bool isOwned)
+ : INHERITED(gpu) {
+ fResource = new Resource(semaphore, isOwned);
}
GrVkSemaphore::~GrVkSemaphore() {
@@ -41,7 +53,13 @@
}
void GrVkSemaphore::Resource::freeGPUData(const GrVkGpu* gpu) const {
- GR_VK_CALL(gpu->vkInterface(),
- DestroySemaphore(gpu->device(), fSemaphore, nullptr));
+ if (fIsOwned) {
+ GR_VK_CALL(gpu->vkInterface(),
+ DestroySemaphore(gpu->device(), fSemaphore, nullptr));
+ }
+}
+
+void GrVkSemaphore::setBackendSemaphore(GrBackendSemaphore* backendSemaphore) const {
+ backendSemaphore->initVulkan(fResource->semaphore());
}