Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-swiftshader: Commit

external/swiftshader


Commit MetaInfo

Revision81e08df29531f0723fadb8e5e90c5850809efc90 (tree)
Time2020-04-15 12:13:18
AuthorAlexis Hetu <sugoi@goog...>
CommiterAlexis Hétu

Log Message

Fix fragments depth values not being clamped

According to the Vulkan 1.2 spec:
"For fixed-point depth buffers, fragment depth values are

always limited to the range [0,1] by clamping after depth
bias addition is performed. Fragment depth values are
clamped even when the depth buffer uses a floating-point
representation."

So, unless the VK_EXT_depth_range_unrestricted extension
is enabled, clamping should always occur.

Bug: b/152634772
Change-Id: I2aee2aeb91efed7399580689fc0ffc0634b2f487
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43869
Presubmit-Ready: Alexis Hétu <sugoi@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>

Change Summary

Incremental Difference

--- a/src/Device/PixelProcessor.cpp
+++ b/src/Device/PixelProcessor.cpp
@@ -123,7 +123,6 @@ const PixelProcessor::State PixelProcessor::update(const Context *context) const
123123 }
124124
125125 state.occlusionEnabled = context->occlusionEnabled;
126- state.depthClamp = (context->depthBias != 0.0f) || (context->slopeDepthBias != 0.0f);
127126
128127 for(int i = 0; i < RENDERTARGETS; i++)
129128 {
--- a/src/Device/PixelProcessor.hpp
+++ b/src/Device/PixelProcessor.hpp
@@ -77,7 +77,6 @@ public:
7777 bool depthTestActive;
7878 bool occlusionEnabled;
7979 bool perspective;
80- bool depthClamp;
8180
8281 BlendState blendState[RENDERTARGETS];
8382
--- a/src/Pipeline/PixelRoutine.cpp
+++ b/src/Pipeline/PixelRoutine.cpp
@@ -85,7 +85,7 @@ void PixelRoutine::quad(Pointer<Byte> cBuffer[RENDERTARGETS], Pointer<Byte> &zBu
8585 x -= *Pointer<Float4>(constants + OFFSET(Constants, X) + q * sizeof(float4));
8686 }
8787
88- z[q] = interpolate(x, Dz[q], z[q], primitive + OFFSET(Primitive, z), false, false, state.depthClamp);
88+ z[q] = interpolate(x, Dz[q], z[q], primitive + OFFSET(Primitive, z), false, false, true);
8989 }
9090 }
9191
Show on old repository browser