Add wait function on GrContext to wait on semaphores.
This behaves like the SkSurface::wait call but is not tied to a specific surface. Change-Id: Ic572296e0f581204bf69a7178645d99e365c0692 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209648 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
dd15d69e1f
commit
06be079791
@ -242,6 +242,16 @@ public:
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Misc.
|
||||
|
||||
|
||||
/**
|
||||
* Inserts a list of GPU semaphores that the current GPU-backed API must wait on before
|
||||
* executing any more commands on the GPU. Skia will take ownership of the underlying semaphores
|
||||
* and delete them once they have been signaled and waited on. If this call returns false, then
|
||||
* the GPU back-end will not wait on any passed in semaphores, and the client will still own the
|
||||
* semaphores.
|
||||
*/
|
||||
bool wait(int numSemaphores, const GrBackendSemaphore* waitSemaphores);
|
||||
|
||||
/**
|
||||
* Call to ensure all drawing to the context has been issued to the underlying 3D API.
|
||||
*/
|
||||
|
@ -239,6 +239,21 @@ int GrContext::maxSurfaceSampleCountForColorType(SkColorType colorType) const {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool GrContext::wait(int numSemaphores, const GrBackendSemaphore waitSemaphores[]) {
|
||||
if (!fGpu || fGpu->caps()->fenceSyncSupport()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < numSemaphores; ++i) {
|
||||
sk_sp<GrSemaphore> sema = fResourceProvider->wrapBackendSemaphore(
|
||||
waitSemaphores[i], GrResourceProvider::SemaphoreWrapType::kWillWait,
|
||||
kAdopt_GrWrapOwnership);
|
||||
fGpu->waitSemaphore(std::move(sema));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrSemaphoresSubmitted GrContext::flush(const GrFlushInfo& info) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
if (this->abandoned()) {
|
||||
|
@ -1774,7 +1774,6 @@ bool GrRenderTargetContext::waitOnSemaphores(int numSemaphores,
|
||||
|
||||
auto resourceProvider = direct->priv().resourceProvider();
|
||||
|
||||
SkTArray<sk_sp<GrSemaphore>> semaphores(numSemaphores);
|
||||
for (int i = 0; i < numSemaphores; ++i) {
|
||||
sk_sp<GrSemaphore> sema = resourceProvider->wrapBackendSemaphore(
|
||||
waitSemaphores[i], GrResourceProvider::SemaphoreWrapType::kWillWait,
|
||||
|
Loading…
Reference in New Issue
Block a user