skia2/include/gpu/GrBackendSemaphore.h
Mike Reed 8724b46099 Revert "Add support for semaphores to be inserted on GrContext flush"
This reverts commit cd1416efbc.

Reason for revert: speculative, to try to fix roll see gpu_tests.pixel_integration_test.PixelIntegrationTest.Pixel_GpuRasterization_ConcavePaths

Original change's description:
> Add support for semaphores to be inserted on GrContext flush
> 
> This also moves the logic of inserting semaphores down into GrDrawingManager
> and finishFlush on GrGpu. With it being on finishFlush, there should be no
> issues when the DrawingManager starts respecting the proxy passed in assuming
> it always calls finishFlush at the end (which it should).
> 
> Bug: skia:
> Change-Id: I925c2a289dcbbb9159b9120878af1d34f21a2dc7
> Reviewed-on: https://skia-review.googlesource.com/25641
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com

Change-Id: I9c5b9cf8c060193e1861dbb8f0c10fb11dfb5249
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/25980
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-07-22 17:34:00 +00:00

72 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
bool isInitialized() const { return fIsInitialized; }
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