summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelle Raaijmakers <jelle@gmta.nl>2023-01-09 11:47:30 +0100
committerJelle Raaijmakers <jelle@gmta.nl>2023-01-09 12:55:41 +0100
commit44d679ba7ecd9d2e68168cfeaea9fb6ecce1cf12 (patch)
tree31b8316b21a0fb443d0962411379351048641d25
parent577c5522098f155cd12d441c68ca5ea42c446ab8 (diff)
downloadserenity-44d679ba7ecd9d2e68168cfeaea9fb6ecce1cf12.zip
LibSoftGPU: Remove workaround for i686 depth comparison
-rw-r--r--Userland/Libraries/LibSoftGPU/Device.cpp29
1 files changed, 0 insertions, 29 deletions
diff --git a/Userland/Libraries/LibSoftGPU/Device.cpp b/Userland/Libraries/LibSoftGPU/Device.cpp
index a506880b0c..269407a8b9 100644
--- a/Userland/Libraries/LibSoftGPU/Device.cpp
+++ b/Userland/Libraries/LibSoftGPU/Device.cpp
@@ -390,39 +390,10 @@ ALWAYS_INLINE void Device::rasterize(Gfx::IntRect& render_bounds, CB1 set_covera
depth_test_passed = quad.depth >= depth;
break;
case GPU::DepthTestFunction::NotEqual:
-#ifdef __SSE__
depth_test_passed = quad.depth != depth;
-#else
- depth_test_passed = i32x4 {
- bit_cast<u32>(quad.depth[0]) != bit_cast<u32>(depth[0]) ? -1 : 0,
- bit_cast<u32>(quad.depth[1]) != bit_cast<u32>(depth[1]) ? -1 : 0,
- bit_cast<u32>(quad.depth[2]) != bit_cast<u32>(depth[2]) ? -1 : 0,
- bit_cast<u32>(quad.depth[3]) != bit_cast<u32>(depth[3]) ? -1 : 0,
- };
-#endif
break;
case GPU::DepthTestFunction::Equal:
-#ifdef __SSE__
depth_test_passed = quad.depth == depth;
-#else
- //
- // This is an interesting quirk that occurs due to us using the x87 FPU when Serenity is
- // compiled for the i686 target. When we calculate our depth value to be stored in the buffer,
- // it is an 80-bit x87 floating point number, however, when stored into the depth buffer, this is
- // truncated to 32 bits. This 38 bit loss of precision means that when x87 `FCOMP` is eventually
- // used here the comparison fails.
- // This could be solved by using a `long double` for the depth buffer, however this would take
- // up significantly more space and is completely overkill for a depth buffer. As such, comparing
- // the first 32-bits of this depth value is "good enough" that if we get a hit on it being
- // equal, we can pretty much guarantee that it's actually equal.
- //
- depth_test_passed = i32x4 {
- bit_cast<u32>(quad.depth[0]) == bit_cast<u32>(depth[0]) ? -1 : 0,
- bit_cast<u32>(quad.depth[1]) == bit_cast<u32>(depth[1]) ? -1 : 0,
- bit_cast<u32>(quad.depth[2]) == bit_cast<u32>(depth[2]) ? -1 : 0,
- bit_cast<u32>(quad.depth[3]) == bit_cast<u32>(depth[3]) ? -1 : 0,
- };
-#endif
break;
case GPU::DepthTestFunction::LessOrEqual:
depth_test_passed = quad.depth <= depth;