mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 08:41:15 +00:00
LibGL: Add support for GL_BLEND in glEnable() and glDisable()
This commit is contained in:
parent
279737642c
commit
d6e9b433cf
Notes:
sideshowbarker
2024-07-18 18:03:44 +09:00
Author: https://github.com/sunverwerth Commit: https://github.com/SerenityOS/serenity/commit/d6e9b433cf7 Pull-request: https://github.com/SerenityOS/serenity/pull/7156
|
@ -36,6 +36,7 @@ extern "C" {
|
|||
// Enable capabilities
|
||||
#define GL_CULL_FACE 0x0B44
|
||||
#define GL_DEPTH_TEST 0x0B71
|
||||
#define GL_BLEND 0x0BE2
|
||||
|
||||
// Utility
|
||||
#define GL_VENDOR 0x1F00
|
||||
|
|
|
@ -683,6 +683,11 @@ void SoftwareGLContext::gl_enable(GLenum capability)
|
|||
rasterizer_options.enable_depth_test = true;
|
||||
update_rasterizer_options = true;
|
||||
break;
|
||||
case GL_BLEND:
|
||||
m_blend_enabled = true;
|
||||
rasterizer_options.enable_blending = true;
|
||||
update_rasterizer_options = true;
|
||||
break;
|
||||
default:
|
||||
m_error = GL_INVALID_ENUM;
|
||||
break;
|
||||
|
@ -713,6 +718,11 @@ void SoftwareGLContext::gl_disable(GLenum capability)
|
|||
rasterizer_options.enable_depth_test = false;
|
||||
update_rasterizer_options = true;
|
||||
break;
|
||||
case GL_BLEND:
|
||||
m_blend_enabled = false;
|
||||
rasterizer_options.enable_blending = false;
|
||||
update_rasterizer_options = false;
|
||||
break;
|
||||
default:
|
||||
m_error = GL_INVALID_ENUM;
|
||||
break;
|
||||
|
@ -908,6 +918,11 @@ void SoftwareGLContext::gl_blend_func(GLenum src_factor, GLenum dst_factor)
|
|||
|
||||
m_blend_source_factor = src_factor;
|
||||
m_blend_destination_factor = dst_factor;
|
||||
|
||||
auto options = m_rasterizer.options();
|
||||
options.blend_source_factor = m_blend_source_factor;
|
||||
options.blend_destination_factor = m_blend_destination_factor;
|
||||
m_rasterizer.set_options(options);
|
||||
}
|
||||
|
||||
void SoftwareGLContext::present()
|
||||
|
|
|
@ -106,6 +106,7 @@ private:
|
|||
GLenum m_front_face = GL_CCW;
|
||||
GLenum m_culled_sides = GL_BACK;
|
||||
|
||||
bool m_blend_enabled = false;
|
||||
GLenum m_blend_source_factor = GL_ONE;
|
||||
GLenum m_blend_destination_factor = GL_ZERO;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "DepthBuffer.h"
|
||||
#include "GL/gl.h"
|
||||
#include "GLStruct.h"
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
|
@ -15,8 +16,11 @@
|
|||
namespace GL {
|
||||
|
||||
struct RasterizerOptions {
|
||||
bool shade_smooth { false };
|
||||
bool shade_smooth { true };
|
||||
bool enable_depth_test { false };
|
||||
bool enable_blending { false };
|
||||
GLenum blend_source_factor { GL_ONE };
|
||||
GLenum blend_destination_factor { GL_ONE };
|
||||
};
|
||||
|
||||
class SoftwareRasterizer final {
|
||||
|
|
Loading…
Reference in a new issue