mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:17:44 +00:00
LibGL+LibSoftGPU: Implement fixed pipeline support for GL_COMBINE
`GL_COMBINE` is basically a fixed function calculator to perform simple arithmetics on configurable fragment sources. This patch implements a number of texture env parameters with support for the RGBA internal format.
This commit is contained in:
parent
494024b70e
commit
1d36bfdac1
10 changed files with 461 additions and 58 deletions
|
@ -134,10 +134,13 @@ Vector4<AK::SIMD::f32x4> Sampler::sample_2d(Vector2<AK::SIMD::f32x4> const& uv)
|
|||
if (m_config.mipmap_filter == GPU::MipMapFilter::None)
|
||||
return sample_2d_lod(uv, expand4(base_level), m_config.texture_min_filter);
|
||||
|
||||
// FIXME: add texture-level support for GL_TEXTURE_LOD_BIAS; below is only texture unit-level
|
||||
auto texture_lod_bias = AK::clamp(m_config.level_of_detail_bias, -MAX_TEXTURE_LOD_BIAS, MAX_TEXTURE_LOD_BIAS);
|
||||
// FIXME: Instead of clamping to num_levels - 1, actually make the max mipmap level configurable with glTexParameteri(GL_TEXTURE_MAX_LEVEL, max_level)
|
||||
auto min_level = expand4(static_cast<float>(base_level));
|
||||
auto max_level = expand4(image.num_levels() - 1.0f);
|
||||
auto level = min(max(log2_approximate(scale_factor) * 0.5f, min_level), max_level);
|
||||
auto max_level = expand4(static_cast<float>(image.num_levels()) - 1.f);
|
||||
auto lambda_xy = log2_approximate(scale_factor) * .5f + texture_lod_bias;
|
||||
auto level = clamp(lambda_xy, min_level, max_level);
|
||||
|
||||
auto lower_level_texel = sample_2d_lod(uv, to_u32x4(level), m_config.texture_min_filter);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue