From c08dfe063abd30ce2d00042983fa2c3197dc1c8b Mon Sep 17 00:00:00 2001 From: Jesse Buhagiar Date: Fri, 25 Mar 2022 22:50:36 +1100 Subject: [PATCH] LibGL: Add stub for glCopyTexSubImage2D --- Userland/Libraries/LibGL/GL/gl.h | 1 + Userland/Libraries/LibGL/GLContext.cpp | 12 ++++++++++++ Userland/Libraries/LibGL/GLContext.h | 4 +++- Userland/Libraries/LibGL/GLTexture.cpp | 5 +++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGL/GL/gl.h b/Userland/Libraries/LibGL/GL/gl.h index cebceefb065..7824f41b993 100644 --- a/Userland/Libraries/LibGL/GL/gl.h +++ b/Userland/Libraries/LibGL/GL/gl.h @@ -681,6 +681,7 @@ GLAPI void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GL GLAPI void glPointSize(GLfloat size); GLAPI void glClipPlane(GLenum plane, GLdouble const* equation); GLAPI void glArrayElement(GLint i); +GLAPI void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); #ifdef __cplusplus } diff --git a/Userland/Libraries/LibGL/GLContext.cpp b/Userland/Libraries/LibGL/GLContext.cpp index 504eb6918d6..de736239233 100644 --- a/Userland/Libraries/LibGL/GLContext.cpp +++ b/Userland/Libraries/LibGL/GLContext.cpp @@ -3721,6 +3721,18 @@ void GLContext::get_material_param(Face face, GLenum pname, T* params) } } +void GLContext::gl_copy_tex_sub_image_2d(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_copy_tex_sub_image_2d, target, level, xoffset, yoffset, x, y, width, height); + RETURN_WITH_ERROR_IF(!(target == GL_TEXTURE_2D || target == GL_TEXTURE_1D_ARRAY), GL_INVALID_ENUM); + RETURN_WITH_ERROR_IF(level < 0, GL_INVALID_VALUE); + RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION); + + // FIXME: implement + dbgln_if(GL_DEBUG, "GLContext FIXME: implement gl_copy_tex_sub_image_2d({:#x}, {}, {}, {}, {}, {}, {}, {})", + target, level, xoffset, yoffset, x, y, width, height); +} + NonnullOwnPtr create_context(Gfx::Bitmap& bitmap) { // FIXME: Make driver selectable. This is currently hardcoded to LibSoftGPU diff --git a/Userland/Libraries/LibGL/GLContext.h b/Userland/Libraries/LibGL/GLContext.h index 47c575479f6..75701e07d6e 100644 --- a/Userland/Libraries/LibGL/GLContext.h +++ b/Userland/Libraries/LibGL/GLContext.h @@ -159,6 +159,7 @@ public: void gl_get_material(GLenum face, GLenum pname, void* params, GLenum type); void gl_clip_plane(GLenum plane, GLdouble const* equation); void gl_array_element(GLint i); + void gl_copy_tex_sub_image_2d(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); void present(); private: @@ -402,7 +403,8 @@ private: decltype(&GLContext::gl_color_material), decltype(&GLContext::gl_get_light), decltype(&GLContext::gl_clip_plane), - decltype(&GLContext::gl_array_element)>; + decltype(&GLContext::gl_array_element), + decltype(&GLContext::gl_copy_tex_sub_image_2d)>; using ExtraSavedArguments = Variant< FloatMatrix4x4>; diff --git a/Userland/Libraries/LibGL/GLTexture.cpp b/Userland/Libraries/LibGL/GLTexture.cpp index adf43b416fd..7abaeaca920 100644 --- a/Userland/Libraries/LibGL/GLTexture.cpp +++ b/Userland/Libraries/LibGL/GLTexture.cpp @@ -111,3 +111,8 @@ void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint* p { g_gl_context->gl_get_tex_parameter_integerv(target, level, pname, params); } + +void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + g_gl_context->gl_copy_tex_sub_image_2d(target, level, xoffset, yoffset, x, y, width, height); +}