mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-29 19:10:26 +00:00
LibGL: Implement glEnableClientState and glDisableClientState
This commit is contained in:
parent
5f863016ca
commit
886f154c2a
Notes:
sideshowbarker
2024-07-18 06:57:59 +09:00
Author: https://github.com/sunverwerth Commit: https://github.com/SerenityOS/serenity/commit/886f154c2ab Pull-request: https://github.com/SerenityOS/serenity/pull/9382 Reviewed-by: https://github.com/alimpfard
5 changed files with 65 additions and 0 deletions
|
@ -354,6 +354,8 @@ GLAPI void glBindTexture(GLenum target, GLuint texture);
|
|||
GLAPI void glActiveTexture(GLenum texture);
|
||||
GLAPI void glGetFloatv(GLenum pname, GLfloat* params);
|
||||
GLAPI void glDepthMask(GLboolean flag);
|
||||
GLAPI void glEnableClientState(GLenum cap);
|
||||
GLAPI void glDisableClientState(GLenum cap);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -64,6 +64,8 @@ public:
|
|||
virtual void gl_active_texture(GLenum texture) = 0;
|
||||
virtual void gl_get_floatv(GLenum pname, GLfloat* params) = 0;
|
||||
virtual void gl_depth_mask(GLboolean flag) = 0;
|
||||
virtual void gl_enable_client_state(GLenum cap) = 0;
|
||||
virtual void gl_disable_client_state(GLenum cap) = 0;
|
||||
|
||||
virtual void present() = 0;
|
||||
};
|
||||
|
|
|
@ -94,3 +94,13 @@ void glDepthMask(GLboolean flag)
|
|||
{
|
||||
g_gl_context->gl_depth_mask(flag);
|
||||
}
|
||||
|
||||
void glEnableClientState(GLenum cap)
|
||||
{
|
||||
g_gl_context->gl_enable_client_state(cap);
|
||||
}
|
||||
|
||||
void glDisableClientState(GLenum cap)
|
||||
{
|
||||
g_gl_context->gl_disable_client_state(cap);
|
||||
}
|
||||
|
|
|
@ -1403,6 +1403,50 @@ void SoftwareGLContext::gl_depth_mask(GLboolean flag)
|
|||
m_rasterizer.set_options(options);
|
||||
}
|
||||
|
||||
void SoftwareGLContext::gl_enable_client_state(GLenum cap)
|
||||
{
|
||||
RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION);
|
||||
|
||||
switch (cap) {
|
||||
case GL_VERTEX_ARRAY:
|
||||
m_client_side_vertex_array_enabled = true;
|
||||
break;
|
||||
|
||||
case GL_COLOR_ARRAY:
|
||||
m_client_side_color_array_enabled = true;
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
m_client_side_texture_coord_array_enabled = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
RETURN_WITH_ERROR_IF(true, GL_INVALID_ENUM);
|
||||
}
|
||||
}
|
||||
|
||||
void SoftwareGLContext::gl_disable_client_state(GLenum cap)
|
||||
{
|
||||
RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION);
|
||||
|
||||
switch (cap) {
|
||||
case GL_VERTEX_ARRAY:
|
||||
m_client_side_vertex_array_enabled = false;
|
||||
break;
|
||||
|
||||
case GL_COLOR_ARRAY:
|
||||
m_client_side_color_array_enabled = false;
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
m_client_side_texture_coord_array_enabled = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
RETURN_WITH_ERROR_IF(true, GL_INVALID_ENUM);
|
||||
}
|
||||
}
|
||||
|
||||
void SoftwareGLContext::present()
|
||||
{
|
||||
m_rasterizer.blit_to(*m_frontbuffer);
|
||||
|
|
|
@ -74,6 +74,8 @@ public:
|
|||
virtual void gl_active_texture(GLenum texture) override;
|
||||
virtual void gl_get_floatv(GLenum pname, GLfloat* params) override;
|
||||
virtual void gl_depth_mask(GLboolean flag) override;
|
||||
virtual void gl_enable_client_state(GLenum cap) override;
|
||||
virtual void gl_disable_client_state(GLenum cap) override;
|
||||
|
||||
virtual void present() override;
|
||||
|
||||
|
@ -134,6 +136,11 @@ private:
|
|||
|
||||
GLenum m_current_read_buffer = GL_BACK;
|
||||
|
||||
// Client side arrays
|
||||
bool m_client_side_vertex_array_enabled = false;
|
||||
bool m_client_side_color_array_enabled = false;
|
||||
bool m_client_side_texture_coord_array_enabled = false;
|
||||
|
||||
NonnullRefPtr<Gfx::Bitmap> m_frontbuffer;
|
||||
|
||||
Clipper m_clipper;
|
||||
|
|
Loading…
Reference in a new issue