diff options
author | Stephan Unverwerth <s.unverwerth@serenityos.org> | 2022-01-05 19:50:41 +0100 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2022-01-09 16:21:13 +0330 |
commit | 66cf2ea2405615e7aa9c74b4088910c83729b0cb (patch) | |
tree | 94605866586851b9335f1133145b721dc034f56f /Userland | |
parent | f510a3cd8f15129fa842b2e6e46daa7354734682 (diff) | |
download | serenity-66cf2ea2405615e7aa9c74b4088910c83729b0cb.zip |
LibSoftGPU: Only interpolate fog values if fog is enabled
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibSoftGPU/Device.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Userland/Libraries/LibSoftGPU/Device.cpp b/Userland/Libraries/LibSoftGPU/Device.cpp index b1bdd03599..2e5501e8ea 100644 --- a/Userland/Libraries/LibSoftGPU/Device.cpp +++ b/Userland/Libraries/LibSoftGPU/Device.cpp @@ -375,12 +375,14 @@ static void rasterize_triangle(const RasterizerOptions& options, Gfx::Bitmap& re quad.uv = interpolate(expand4(vertex0.tex_coord), expand4(vertex1.tex_coord), expand4(vertex2.tex_coord), quad.barycentrics); - // Calculate depth of fragment for fog - // - // OpenGL 1.5 spec chapter 3.10: "An implementation may choose to approximate the - // eye-coordinate distance from the eye to each fragment center by |Ze|." + if (options.fog_enabled) { + // Calculate depth of fragment for fog + // + // OpenGL 1.5 spec chapter 3.10: "An implementation may choose to approximate the + // eye-coordinate distance from the eye to each fragment center by |Ze|." - quad.fog_depth = interpolate(expand4(vertex0_eye_absz), expand4(vertex1_eye_absz), expand4(vertex2_eye_absz), quad.barycentrics); + quad.fog_depth = interpolate(expand4(vertex0_eye_absz), expand4(vertex1_eye_absz), expand4(vertex2_eye_absz), quad.barycentrics); + } pixel_shader(quad); |