skia2/include/gpu/GrBackendSemaphore.h
Greg Daniel a5cb781c17 Revert "Revert "Add API for flushing surfaces with gpu semaphores""
This reverts commit 7292231905.

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 66366c6978.
> 
> 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>
2017-06-16 14:22:34 +00:00

70 lines
1.6 KiB
C++

/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrBackendSemaphore_DEFINED
#define GrBackendSemaphore_DEFINED
#include "GrTypes.h"
#include "gl/GrGLTypes.h"
#ifdef SK_VULKAN
#include "vk/GrVkTypes.h"
#endif
/**
* Wrapper class for passing into and receiving data from Ganesh about a backend semaphore object.
*/
class GrBackendSemaphore {
public:
// For convenience we just set the backend here to OpenGL. The GrBackendSemaphore cannot be used
// until either initGL or initVulkan are called which will set the appropriate GrBackend.
GrBackendSemaphore() : fBackend(kOpenGL_GrBackend), fGLSync(0), fIsInitialized(false) {}
void initGL(GrGLsync sync) {
fBackend = kOpenGL_GrBackend;
fGLSync = sync;
fIsInitialized = true;
}
#ifdef SK_VULKAN
void initVulkan(VkSemaphore semaphore) {
fBackend = kVulkan_GrBackend;
fVkSemaphore = semaphore;
fIsInitialized = true;
}
#endif
GrGLsync glSync() const {
if (!fIsInitialized || kOpenGL_GrBackend != fBackend) {
return 0;
}
return fGLSync;
}
#ifdef SK_VULKAN
VkSemaphore vkSemaphore() const {
if (!fIsInitialized || kVulkan_GrBackend != fBackend) {
return VK_NULL_HANDLE;
}
return fVkSemaphore;
}
#endif
private:
GrBackend fBackend;
union {
GrGLsync fGLSync;
#ifdef SK_VULKAN
VkSemaphore fVkSemaphore;
#endif
};
bool fIsInitialized;
};
#endif