summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorStephan Unverwerth <s.unverwerth@gmx.de>2021-05-14 21:47:25 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-14 22:15:50 +0200
commit2b9ad11bd815724855bbc207ef58b74787d4cc2d (patch)
treed9edccbc20edc2baf27556148bafaa4c7d6dd819 /Userland/Libraries
parent3429b4416119fbaeebee904aff36e7d2af84a261 (diff)
downloadserenity-2b9ad11bd815724855bbc207ef58b74787d4cc2d.zip
LibGL: Implement glFlush() and glFinish()
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibGL/GL/gl.h2
-rw-r--r--Userland/Libraries/LibGL/GLContext.h2
-rw-r--r--Userland/Libraries/LibGL/GLUtils.cpp10
-rw-r--r--Userland/Libraries/LibGL/SoftwareGLContext.cpp20
-rw-r--r--Userland/Libraries/LibGL/SoftwareGLContext.h2
5 files changed, 36 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGL/GL/gl.h b/Userland/Libraries/LibGL/GL/gl.h
index 1896caaa35..806e23fb3a 100644
--- a/Userland/Libraries/LibGL/GL/gl.h
+++ b/Userland/Libraries/LibGL/GL/gl.h
@@ -124,6 +124,8 @@ void glCallList(GLuint list);
void glDeleteLists(GLuint list, GLsizei range);
void glEndList(void);
void glNewList(GLuint list, GLenum mode);
+void glFlush();
+void glFinish();
#ifdef __cplusplus
}
diff --git a/Userland/Libraries/LibGL/GLContext.h b/Userland/Libraries/LibGL/GLContext.h
index 3c2b830ad8..dffa8073ed 100644
--- a/Userland/Libraries/LibGL/GLContext.h
+++ b/Userland/Libraries/LibGL/GLContext.h
@@ -47,6 +47,8 @@ public:
virtual void gl_delete_lists(GLuint list, GLsizei range) = 0;
virtual void gl_end_list(void) = 0;
virtual void gl_new_list(GLuint list, GLenum mode) = 0;
+ virtual void gl_flush() = 0;
+ virtual void gl_finish() = 0;
virtual void present() = 0;
};
diff --git a/Userland/Libraries/LibGL/GLUtils.cpp b/Userland/Libraries/LibGL/GLUtils.cpp
index 0bfe7041d6..d3f37c1ce7 100644
--- a/Userland/Libraries/LibGL/GLUtils.cpp
+++ b/Userland/Libraries/LibGL/GLUtils.cpp
@@ -59,3 +59,13 @@ GLenum glGetError()
{
return g_gl_context->gl_get_error();
}
+
+void glFlush()
+{
+ return g_gl_context->gl_flush();
+}
+
+void glFinish()
+{
+ return g_gl_context->gl_finish();
+}
diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp
index e952dab48e..1d531dbd53 100644
--- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp
+++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp
@@ -839,6 +839,26 @@ void SoftwareGLContext::gl_new_list(GLuint list, GLenum mode)
m_current_listing_index = CurrentListing { {}, static_cast<size_t>(list - 1), mode };
}
+void SoftwareGLContext::gl_flush()
+{
+ if (m_in_draw_state) {
+ m_error = GL_INVALID_OPERATION;
+ return;
+ }
+
+ // No-op since SoftwareGLContext is completely synchronous at the moment
+}
+
+void SoftwareGLContext::gl_finish()
+{
+ if (m_in_draw_state) {
+ m_error = GL_INVALID_OPERATION;
+ return;
+ }
+
+ // No-op since SoftwareGLContext is completely synchronous at the moment
+}
+
void SoftwareGLContext::present()
{
m_rasterizer.blit_to(*m_frontbuffer);
diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.h b/Userland/Libraries/LibGL/SoftwareGLContext.h
index 04982769f2..a1d84e00c6 100644
--- a/Userland/Libraries/LibGL/SoftwareGLContext.h
+++ b/Userland/Libraries/LibGL/SoftwareGLContext.h
@@ -53,6 +53,8 @@ public:
virtual void gl_delete_lists(GLuint list, GLsizei range) override;
virtual void gl_end_list(void) override;
virtual void gl_new_list(GLuint list, GLenum mode) override;
+ virtual void gl_flush() override;
+ virtual void gl_finish() override;
virtual void present() override;