Implementation of EGL_KHR_fence_sync.

Bug 21662268

Change-Id: Iefdc18303c42967ccc25fd6580851e05520dc2b9
Reviewed-on: https://swiftshader-review.googlesource.com/4071
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/libGLES_CM/Context.h b/src/OpenGL/libGLES_CM/Context.h
index 9c03e26..fc15144 100644
--- a/src/OpenGL/libGLES_CM/Context.h
+++ b/src/OpenGL/libGLES_CM/Context.h
@@ -294,6 +294,7 @@
 

 	virtual void makeCurrent(egl::Surface *surface);

 	virtual int getClientVersion() const;

+    virtual void finish();

 

     void markAllStateDirty();

 

@@ -486,7 +487,6 @@
     void drawArrays(GLenum mode, GLint first, GLsizei count);

     void drawElements(GLenum mode, GLsizei count, GLenum type, const void *indices);

     void drawTexture(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);

-    void finish();

     void flush();

 

     void recordInvalidEnum();

diff --git a/src/OpenGL/libGLES_CM/exports.map b/src/OpenGL/libGLES_CM/exports.map
index 22246b1..dcf548f 100644
--- a/src/OpenGL/libGLES_CM/exports.map
+++ b/src/OpenGL/libGLES_CM/exports.map
@@ -205,6 +205,10 @@
     glDrawTexxvOES;
     glDrawTexfOES;
     glDrawTexfvOES;
+    eglCreateSyncKHR;
+    eglDestroySyncKHR;
+    eglClientWaitSyncKHR;
+    eglGetSyncAttribKHR;
 
     libGLES_CM_swiftshader;
 
diff --git a/src/OpenGL/libGLES_CM/libGLES_CM.cpp b/src/OpenGL/libGLES_CM/libGLES_CM.cpp
index 1951dd9..ea1291d 100644
--- a/src/OpenGL/libGLES_CM/libGLES_CM.cpp
+++ b/src/OpenGL/libGLES_CM/libGLES_CM.cpp
@@ -2273,6 +2273,7 @@
 			"GL_OES_depth_texture "

 			"GL_OES_EGL_image "

 			"GL_OES_EGL_image_external "

+			"GL_OES_EGL_sync "

 			"GL_OES_element_index_uint "

 			"GL_OES_framebuffer_object "

 			"GL_OES_packed_depth_stencil "

diff --git a/src/OpenGL/libGLES_CM/libGLES_CM.def b/src/OpenGL/libGLES_CM/libGLES_CM.def
index 0864513..cf15c8b 100644
--- a/src/OpenGL/libGLES_CM/libGLES_CM.def
+++ b/src/OpenGL/libGLES_CM/libGLES_CM.def
@@ -204,7 +204,11 @@
     glDrawTexxvOES
     glDrawTexfOES
     glDrawTexfvOES
+    eglCreateSyncKHR
+    eglDestroySyncKHR
+    eglClientWaitSyncKHR
+    eglGetSyncAttribKHR
 
 	libGLES_CM_swiftshader
 
-	Register
\ No newline at end of file
+	Register
diff --git a/src/OpenGL/libGLES_CM/main.cpp b/src/OpenGL/libGLES_CM/main.cpp
index 9ec5656..38a50aa 100644
--- a/src/OpenGL/libGLES_CM/main.cpp
+++ b/src/OpenGL/libGLES_CM/main.cpp
@@ -521,6 +521,26 @@
 	return libEGL->eglGetProcAddress(procname);

 }

 

+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)

+{

+	return libEGL->eglCreateSyncKHR(dpy, type, attrib_list);

+}

+

+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)

+{

+	return libEGL->eglDestroySyncKHR(dpy, sync);

+}

+

+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)

+{

+	return libEGL->eglClientWaitSyncKHR(dpy, sync, flags, timeout);

+}

+

+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value)

+{

+	return libEGL->eglGetSyncAttribKHR(dpy, sync, attribute, value);

+}

+

 GL_API void GL_APIENTRY glActiveTexture(GLenum texture)

 {

 	return es1::ActiveTexture(texture);

@@ -1593,4 +1613,4 @@
 	return &libGLES_CM;

 }

 

-LibEGL libEGL;
\ No newline at end of file
+LibEGL libEGL;