1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:17:44 +00:00

LibGL: Add defines and stubs for glBlendFunc()

This commit is contained in:
Stephan Unverwerth 2021-05-15 22:45:05 +02:00 committed by Linus Groh
parent 1b358d3b94
commit 279737642c
6 changed files with 92 additions and 0 deletions

View file

@ -859,6 +859,57 @@ void SoftwareGLContext::gl_finish()
// No-op since SoftwareGLContext is completely synchronous at the moment
}
void SoftwareGLContext::gl_blend_func(GLenum src_factor, GLenum dst_factor)
{
if (m_in_draw_state) {
m_error = GL_INVALID_OPERATION;
return;
}
// FIXME: The list of allowed enums differs between API versions
// This was taken from the 2.0 spec on https://docs.gl/gl2/glBlendFunc
if (!(src_factor == GL_ZERO
|| src_factor == GL_ONE
|| src_factor == GL_SRC_COLOR
|| src_factor == GL_ONE_MINUS_SRC_COLOR
|| src_factor == GL_DST_COLOR
|| src_factor == GL_ONE_MINUS_DST_COLOR
|| src_factor == GL_SRC_ALPHA
|| src_factor == GL_ONE_MINUS_SRC_ALPHA
|| src_factor == GL_DST_ALPHA
|| src_factor == GL_ONE_MINUS_DST_ALPHA
|| src_factor == GL_CONSTANT_COLOR
|| src_factor == GL_ONE_MINUS_CONSTANT_COLOR
|| src_factor == GL_CONSTANT_ALPHA
|| src_factor == GL_ONE_MINUS_CONSTANT_ALPHA
|| src_factor == GL_SRC_ALPHA_SATURATE)) {
m_error = GL_INVALID_ENUM;
return;
}
if (!(dst_factor == GL_ZERO
|| dst_factor == GL_ONE
|| dst_factor == GL_SRC_COLOR
|| dst_factor == GL_ONE_MINUS_SRC_COLOR
|| dst_factor == GL_DST_COLOR
|| dst_factor == GL_ONE_MINUS_DST_COLOR
|| dst_factor == GL_SRC_ALPHA
|| dst_factor == GL_ONE_MINUS_SRC_ALPHA
|| dst_factor == GL_DST_ALPHA
|| dst_factor == GL_ONE_MINUS_DST_ALPHA
|| dst_factor == GL_CONSTANT_COLOR
|| dst_factor == GL_ONE_MINUS_CONSTANT_COLOR
|| dst_factor == GL_CONSTANT_ALPHA
|| dst_factor == GL_ONE_MINUS_CONSTANT_ALPHA)) {
m_error = GL_INVALID_ENUM;
return;
}
m_blend_source_factor = src_factor;
m_blend_destination_factor = dst_factor;
}
void SoftwareGLContext::present()
{
m_rasterizer.blit_to(*m_frontbuffer);