Split FenceImpl into FenceNVImpl and FenceSyncImpl, and refactor.
Move Windows-specific code out of Fence.cpp. Split FenceImpl
based on suggestions on previous review
https://chromium-review.googlesource.com/221805/ . Refactored
further based on code review feedback and added first unit tests.
BUG=angleproject:774
Change-Id: I630034e1788e48ddb7722016ca22da474e785798
Reviewed-on: https://chromium-review.googlesource.com/222954
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Tested-by: Kenneth Russell <kbr@chromium.org>
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index f528222..054e310 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -2139,19 +2139,35 @@
switch (pname)
{
case GL_FENCE_STATUS_NV:
+ {
+ // GL_NV_fence spec:
+ // Once the status of a fence has been finished (via FinishFenceNV) or tested and the returned status is TRUE (via either TestFenceNV
+ // or GetFenceivNV querying the FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence.
+ GLboolean status = GL_TRUE;
+ if (fenceObject->getStatus() != GL_TRUE)
+ {
+ gl::Error error = fenceObject->testFence(&status);
+ if (error.isError())
+ {
+ context->recordError(error);
+ return;
+ }
+ }
+ *params = status;
+ break;
+ }
+
case GL_FENCE_CONDITION_NV:
- break;
+ {
+ *params = fenceObject->getCondition();
+ break;
+ }
default:
- context->recordError(gl::Error(GL_INVALID_ENUM));
- return;
- }
-
- gl::Error error = fenceObject->getFencei(pname, params);
- if (error.isError())
- {
- context->recordError(error);
- return;
+ {
+ context->recordError(gl::Error(GL_INVALID_ENUM));
+ return;
+ }
}
}
}
@@ -7548,7 +7564,7 @@
return;
}
- gl::Error error = fenceSync->serverWait();
+ gl::Error error = fenceSync->serverWait(flags, timeout);
if (error.isError())
{
context->recordError(error);