Updated the FenceSync and FenceNV objects to use Error objects.
BUG=angle:520
Change-Id: I1e49b35905d8916baadb129c8aa58a11bd721500
Reviewed-on: https://chromium-review.googlesource.com/220781
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index 4532889..8005b6e 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -2117,7 +2117,12 @@
return;
}
- params[0] = fenceObject->getFencei(pname);
+ gl::Error error = fenceObject->getFencei(pname, params);
+ if (error.isError())
+ {
+ context->recordError(error);
+ return;
+ }
}
}
@@ -3861,7 +3866,12 @@
return;
}
- fenceObject->setFence(condition);
+ gl::Error error = fenceObject->setFence(condition);
+ if (error.isError())
+ {
+ context->recordError(error);
+ return;
+ }
}
}
@@ -4135,7 +4145,15 @@
return GL_TRUE;
}
- return fenceObject->testFence();
+ GLboolean result;
+ gl::Error error = fenceObject->testFence(&result);
+ if (error.isError())
+ {
+ context->recordError(error);
+ return GL_TRUE;
+ }
+
+ return result;
}
return GL_TRUE;
@@ -7350,7 +7368,18 @@
return 0;
}
- return context->createFenceSync(condition);
+ GLsync fenceSync = context->createFenceSync();
+
+ gl::FenceSync *fenceSyncObject = context->getFenceSync(fenceSync);
+ gl::Error error = fenceSyncObject->set(condition);
+ if (error.isError())
+ {
+ context->deleteFenceSync(fenceSync);
+ context->recordError(error);
+ return NULL;
+ }
+
+ return fenceSync;
}
return NULL;
@@ -7426,7 +7455,15 @@
return GL_WAIT_FAILED;
}
- return fenceSync->clientWait(flags, timeout);
+ GLenum result = GL_WAIT_FAILED;
+ gl::Error error = fenceSync->clientWait(flags, timeout, &result);
+ if (error.isError())
+ {
+ context->recordError(error);
+ return GL_WAIT_FAILED;
+ }
+
+ return result;
}
return GL_FALSE;
@@ -7466,7 +7503,11 @@
return;
}
- fenceSync->serverWait();
+ gl::Error error = fenceSync->serverWait();
+ if (error.isError())
+ {
+ context->recordError(error);
+ }
}
}
@@ -7533,10 +7574,20 @@
switch (pname)
{
case GL_OBJECT_TYPE: values[0] = static_cast<GLint>(GL_SYNC_FENCE); break;
- case GL_SYNC_STATUS: values[0] = static_cast<GLint>(fenceSync->getStatus()); break;
case GL_SYNC_CONDITION: values[0] = static_cast<GLint>(fenceSync->getCondition()); break;
case GL_SYNC_FLAGS: values[0] = 0; break;
+ case GL_SYNC_STATUS:
+ {
+ gl::Error error = fenceSync->getStatus(values);
+ if (error.isError())
+ {
+ context->recordError(error);
+ return;
+ }
+ break;
+ }
+
default:
context->recordError(gl::Error(GL_INVALID_ENUM));
return;