Make sure we are checking for failed wrapping of semaphores.
Bug: chromium:1098902 Change-Id: I338464b6364b3e0f614e8e084a2b0382b3b975e0 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300258 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
parent
b5f7a07b77
commit
0106fcc8a7
@ -298,7 +298,11 @@ bool GrContext::wait(int numSemaphores, const GrBackendSemaphore waitSemaphores[
|
||||
std::unique_ptr<GrSemaphore> sema = fResourceProvider->wrapBackendSemaphore(
|
||||
waitSemaphores[i], GrResourceProvider::SemaphoreWrapType::kWillWait,
|
||||
kAdopt_GrWrapOwnership);
|
||||
fGpu->waitSemaphore(sema.get());
|
||||
// If we failed to wrap the semaphore it means the client didn't give us a valid semaphore
|
||||
// to begin with. Therefore, it is fine to not wait on it.
|
||||
if (sema) {
|
||||
fGpu->waitSemaphore(sema.get());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -673,7 +673,11 @@ void GrGpu::executeFlushInfo(GrSurfaceProxy* proxies[],
|
||||
info.fSignalSemaphores[i],
|
||||
GrResourceProvider::SemaphoreWrapType::kWillSignal,
|
||||
kBorrow_GrWrapOwnership);
|
||||
this->insertSemaphore(semaphores[i].get());
|
||||
// If we failed to wrap the semaphore it means the client didn't give us a valid
|
||||
// semaphore to begin with. Therefore, it is fine to not signal it.
|
||||
if (semaphores[i]) {
|
||||
this->insertSemaphore(semaphores[i].get());
|
||||
}
|
||||
} else {
|
||||
semaphores[i] = resourceProvider->makeSemaphore(false);
|
||||
if (semaphores[i]) {
|
||||
|
@ -24,7 +24,12 @@ void GrWaitRenderTask::gatherProxyIntervals(GrResourceAllocator* alloc) const {
|
||||
|
||||
bool GrWaitRenderTask::onExecute(GrOpFlushState* flushState) {
|
||||
for (int i = 0; i < fNumSemaphores; ++i) {
|
||||
flushState->gpu()->waitSemaphore(fSemaphores[i].get());
|
||||
// If we don't have a semaphore here it means we failed to wrap it. That happens if the
|
||||
// client didn't give us a valid semaphore to begin with. Therefore, it is fine to not wait
|
||||
// on it.
|
||||
if (fSemaphores[i].get()) {
|
||||
flushState->gpu()->waitSemaphore(fSemaphores[i].get());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1188,12 +1188,14 @@ std::unique_ptr<GrSemaphore> GrD3DGpu::wrapBackendSemaphore(
|
||||
}
|
||||
|
||||
void GrD3DGpu::insertSemaphore(GrSemaphore* semaphore) {
|
||||
SkASSERT(semaphore);
|
||||
GrD3DSemaphore* d3dSem = static_cast<GrD3DSemaphore*>(semaphore);
|
||||
// TODO: Do we need to track the lifetime of this? How do we know it's done?
|
||||
fQueue->Signal(d3dSem->fence(), d3dSem->value());
|
||||
}
|
||||
|
||||
void GrD3DGpu::waitSemaphore(GrSemaphore* semaphore) {
|
||||
SkASSERT(semaphore);
|
||||
GrD3DSemaphore* d3dSem = static_cast<GrD3DSemaphore*>(semaphore);
|
||||
// TODO: Do we need to track the lifetime of this?
|
||||
fQueue->Wait(d3dSem->fence(), d3dSem->value());
|
||||
|
@ -3948,6 +3948,7 @@ std::unique_ptr<GrSemaphore> GrGLGpu::wrapBackendSemaphore(
|
||||
}
|
||||
|
||||
void GrGLGpu::insertSemaphore(GrSemaphore* semaphore) {
|
||||
SkASSERT(semaphore);
|
||||
GrGLSemaphore* glSem = static_cast<GrGLSemaphore*>(semaphore);
|
||||
|
||||
GrGLsync sync;
|
||||
@ -3957,6 +3958,7 @@ void GrGLGpu::insertSemaphore(GrSemaphore* semaphore) {
|
||||
}
|
||||
|
||||
void GrGLGpu::waitSemaphore(GrSemaphore* semaphore) {
|
||||
SkASSERT(semaphore);
|
||||
GrGLSemaphore* glSem = static_cast<GrGLSemaphore*>(semaphore);
|
||||
|
||||
GL_CALL(WaitSync(glSem->sync(), 0, GR_GL_TIMEOUT_IGNORED));
|
||||
|
@ -1352,6 +1352,7 @@ std::unique_ptr<GrSemaphore> GrMtlGpu::wrapBackendSemaphore(
|
||||
|
||||
void GrMtlGpu::insertSemaphore(GrSemaphore* semaphore) {
|
||||
if (@available(macOS 10.14, iOS 12.0, *)) {
|
||||
SkASSERT(semaphore);
|
||||
GrMtlSemaphore* mtlSem = static_cast<GrMtlSemaphore*>(semaphore);
|
||||
|
||||
this->commandBuffer()->encodeSignalEvent(mtlSem->event(), mtlSem->value());
|
||||
@ -1360,6 +1361,7 @@ void GrMtlGpu::insertSemaphore(GrSemaphore* semaphore) {
|
||||
|
||||
void GrMtlGpu::waitSemaphore(GrSemaphore* semaphore) {
|
||||
if (@available(macOS 10.14, iOS 12.0, *)) {
|
||||
SkASSERT(semaphore);
|
||||
GrMtlSemaphore* mtlSem = static_cast<GrMtlSemaphore*>(semaphore);
|
||||
|
||||
this->commandBuffer()->encodeWaitForEvent(mtlSem->event(), mtlSem->value());
|
||||
|
@ -2570,6 +2570,8 @@ std::unique_ptr<GrSemaphore> GrVkGpu::wrapBackendSemaphore(
|
||||
}
|
||||
|
||||
void GrVkGpu::insertSemaphore(GrSemaphore* semaphore) {
|
||||
SkASSERT(semaphore);
|
||||
|
||||
GrVkSemaphore* vkSem = static_cast<GrVkSemaphore*>(semaphore);
|
||||
|
||||
GrVkSemaphore::Resource* resource = vkSem->getResource();
|
||||
@ -2580,6 +2582,8 @@ void GrVkGpu::insertSemaphore(GrSemaphore* semaphore) {
|
||||
}
|
||||
|
||||
void GrVkGpu::waitSemaphore(GrSemaphore* semaphore) {
|
||||
SkASSERT(semaphore);
|
||||
|
||||
GrVkSemaphore* vkSem = static_cast<GrVkSemaphore*>(semaphore);
|
||||
|
||||
GrVkSemaphore::Resource* resource = vkSem->getResource();
|
||||
|
@ -38,6 +38,7 @@ std::unique_ptr<GrVkSemaphore> GrVkSemaphore::MakeWrapped(GrVkGpu* gpu,
|
||||
WrapType wrapType,
|
||||
GrWrapOwnership ownership) {
|
||||
if (VK_NULL_HANDLE == semaphore) {
|
||||
SkDEBUGFAIL("Trying to wrap an invalid VkSemaphore");
|
||||
return nullptr;
|
||||
}
|
||||
bool prohibitSignal = WrapType::kWillWait == wrapType;
|
||||
|
Loading…
Reference in New Issue
Block a user