mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
LibSoftGPU: Remove OpenGL type for alpha blend factors
Replaces the GLenum used for configuring alpha blend factors in the SoftGPU device with out own enum.
This commit is contained in:
parent
40bd73bdef
commit
c720cd00db
3 changed files with 60 additions and 16 deletions
|
@ -1130,9 +1130,39 @@ void SoftwareGLContext::gl_blend_func(GLenum src_factor, GLenum dst_factor)
|
|||
m_blend_source_factor = src_factor;
|
||||
m_blend_destination_factor = dst_factor;
|
||||
|
||||
auto map_gl_blend_factor_to_device = [](GLenum factor) constexpr
|
||||
{
|
||||
switch (factor) {
|
||||
case GL_ZERO:
|
||||
return SoftGPU::BlendFactor::Zero;
|
||||
case GL_ONE:
|
||||
return SoftGPU::BlendFactor::One;
|
||||
case GL_SRC_ALPHA:
|
||||
return SoftGPU::BlendFactor::SrcAlpha;
|
||||
case GL_ONE_MINUS_SRC_ALPHA:
|
||||
return SoftGPU::BlendFactor::OneMinusSrcAlpha;
|
||||
case GL_SRC_COLOR:
|
||||
return SoftGPU::BlendFactor::SrcColor;
|
||||
case GL_ONE_MINUS_SRC_COLOR:
|
||||
return SoftGPU::BlendFactor::OneMinusSrcColor;
|
||||
case GL_DST_ALPHA:
|
||||
return SoftGPU::BlendFactor::DstAlpha;
|
||||
case GL_ONE_MINUS_DST_ALPHA:
|
||||
return SoftGPU::BlendFactor::OneMinusDstAlpha;
|
||||
case GL_DST_COLOR:
|
||||
return SoftGPU::BlendFactor::DstColor;
|
||||
case GL_ONE_MINUS_DST_COLOR:
|
||||
return SoftGPU::BlendFactor::OneMinusDstColor;
|
||||
case GL_SRC_ALPHA_SATURATE:
|
||||
return SoftGPU::BlendFactor::SrcAlphaSaturate;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
};
|
||||
|
||||
auto options = m_rasterizer.options();
|
||||
options.blend_source_factor = m_blend_source_factor;
|
||||
options.blend_destination_factor = m_blend_destination_factor;
|
||||
options.blend_source_factor = map_gl_blend_factor_to_device(m_blend_source_factor);
|
||||
options.blend_destination_factor = map_gl_blend_factor_to_device(m_blend_destination_factor);
|
||||
m_rasterizer.set_options(options);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue