Add state for the new fence sync objects in ES3.
TRAC #23446
Signed-off-by: Geoff Lang
Signed-off-by: Shannon Woods
Authored-by: Jamie Madill
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index a48af12..5571a6b 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -789,6 +789,18 @@
return mResourceManager->createRenderbuffer();
}
+GLsync Context::createFenceSync(GLenum condition)
+{
+ GLuint handle = mResourceManager->createFenceSync();
+
+ gl::FenceSync *fenceSync = mResourceManager->getFenceSync(handle);
+ ASSERT(fenceSync);
+
+ fenceSync->set(condition);
+
+ return reinterpret_cast<GLsync>(handle);
+}
+
GLuint Context::createVertexArray()
{
GLuint handle = mVertexArrayHandleAllocator.allocate();
@@ -875,6 +887,15 @@
mResourceManager->deleteRenderbuffer(renderbuffer);
}
+void Context::deleteFenceSync(GLsync fenceSync)
+{
+ // The spec specifies the underlying Fence object is not deleted until all current
+ // wait commands finish. However, since the name becomes invalid, we cannot query the fence,
+ // and since our API is currently designed for being called from a single thread, we can delete
+ // the fence immediately.
+ mResourceManager->deleteFenceSync(reinterpret_cast<GLuint>(fenceSync));
+}
+
void Context::deleteVertexArray(GLuint vertexArray)
{
auto vertexArrayObject = mVertexArrayMap.find(vertexArray);
@@ -964,6 +985,11 @@
return mResourceManager->getRenderbuffer(handle);
}
+FenceSync *Context::getFenceSync(GLsync handle) const
+{
+ return mResourceManager->getFenceSync(reinterpret_cast<GLuint>(handle));
+}
+
VertexArray *Context::getVertexArray(GLuint handle) const
{
auto vertexArray = mVertexArrayMap.find(handle);