mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 17:44:56 +09:00
LibGL+LibSoftGPU: Add GL_ADD
Texture Environment
This commit is contained in:
parent
e34f199997
commit
c9f44c746a
Notes:
sideshowbarker
2024-07-17 14:15:38 +09:00
Author: https://github.com/Quaker762
Commit: c9f44c746a
Pull-request: https://github.com/SerenityOS/serenity/pull/13271
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/EWouters
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/gmta
Reviewed-by: https://github.com/sunverwerth ✅
4 changed files with 13 additions and 0 deletions
|
@ -475,6 +475,8 @@ extern "C" {
|
|||
#define GL_MODELVIEW_MATRIX 0x0BA6
|
||||
#define GL_PROJECTION_MATRIX 0x0BA7
|
||||
|
||||
#define GL_ADD 0x0104
|
||||
|
||||
GLAPI void glBegin(GLenum mode);
|
||||
GLAPI void glClear(GLbitfield mask);
|
||||
GLAPI void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
|
|
|
@ -2057,6 +2057,7 @@ void GLContext::gl_tex_env(GLenum target, GLenum pname, GLfloat param)
|
|||
case GL_MODULATE:
|
||||
case GL_REPLACE:
|
||||
case GL_DECAL:
|
||||
case GL_ADD:
|
||||
m_active_texture_unit->set_env_mode(param_enum);
|
||||
m_sampler_config_is_dirty = true;
|
||||
break;
|
||||
|
@ -3013,6 +3014,9 @@ void GLContext::sync_device_sampler_config()
|
|||
case GL_DECAL:
|
||||
config.fixed_function_texture_env_mode = GPU::TextureEnvMode::Decal;
|
||||
break;
|
||||
case GL_ADD:
|
||||
config.fixed_function_texture_env_mode = GPU::TextureEnvMode::Add;
|
||||
break;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ enum class TextureEnvMode {
|
|||
Modulate,
|
||||
Replace,
|
||||
Decal,
|
||||
Add,
|
||||
};
|
||||
|
||||
struct SamplerConfig final {
|
||||
|
|
|
@ -991,6 +991,12 @@ ALWAYS_INLINE void Device::shade_fragments(PixelQuad& quad)
|
|||
quad.out_color.set_z(mix(quad.out_color.z(), texel.z(), dst_alpha));
|
||||
break;
|
||||
}
|
||||
case GPU::TextureEnvMode::Add:
|
||||
quad.out_color.set_x(quad.out_color.x() + texel.x());
|
||||
quad.out_color.set_y(quad.out_color.y() + texel.y());
|
||||
quad.out_color.set_z(quad.out_color.z() + texel.z());
|
||||
quad.out_color.set_w(quad.out_color.w() * texel.w()); // FIXME: If texture format is `GL_INTENSITY` alpha components must be added (https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glTexEnv.xml)
|
||||
break;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue