OSDN Git Service

Remove complementary depth buffer option for Vulkan
authorChris Forbes <chrisforbes@google.com>
Tue, 12 Mar 2019 20:01:45 +0000 (13:01 -0700)
committerChris Forbes <chrisforbes@google.com>
Tue, 12 Mar 2019 20:29:33 +0000 (20:29 +0000)
Bug: b/128363727
Change-Id: Id75e138deda980f57b7bd07192b1353b2b414fd8
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/26988
Tested-by: Chris Forbes <chrisforbes@google.com>
Presubmit-Ready: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

src/Device/Context.cpp
src/Device/PixelProcessor.cpp
src/Device/QuadRasterizer.cpp
src/Device/Renderer.cpp
src/Device/SetupProcessor.cpp
src/Device/Surface.cpp
src/Device/SwiftConfig.cpp
src/Device/SwiftConfig.hpp
src/Pipeline/PixelRoutine.cpp
src/Pipeline/SetupRoutine.cpp

index b77cfd1..4f231bf 100644 (file)
@@ -36,7 +36,6 @@ namespace sw
        bool forceWindowed = false;
        bool quadLayoutEnabled = false;
        bool veryEarlyDepthTest = true;
-       bool complementaryDepthBuffer = false;
        bool postBlendSRGB = false;
        bool exactColorRounding = false;
        TransparencyAntialiasing transparencyAntialiasing = TRANSPARENCY_NONE;
index 25628e9..0a91185 100644 (file)
@@ -25,7 +25,6 @@
 
 namespace sw
 {
-       extern bool complementaryDepthBuffer;
        extern TransparencyAntialiasing transparencyAntialiasing;
        extern bool perspectiveCorrection;
 
index 1d24bbc..637a287 100644 (file)
@@ -23,7 +23,6 @@
 namespace sw
 {
        extern bool veryEarlyDepthTest;
-       extern bool complementaryDepthBuffer;
        extern bool fullPixelPositionRegister;
 
        extern int clusterCount;
@@ -195,16 +194,7 @@ namespace sw
                                                        zValue = *Pointer<Float4>(buffer, 16);
                                                }
 
-                                               Int4 zTest;
-
-                                               if(complementaryDepthBuffer)
-                                               {
-                                                       zTest = CmpLE(zValue, z);
-                                               }
-                                               else
-                                               {
-                                                       zTest = CmpNLT(zValue, z);
-                                               }
+                                               Int4 zTest = CmpNLT(zValue, z);
 
                                                Int zMask = SignMask(zTest);
 
index 2bfa17b..fadca89 100644 (file)
@@ -53,7 +53,6 @@ namespace sw
        extern bool colorsDefaultToZero;
 
        extern bool forceWindowed;
-       extern bool complementaryDepthBuffer;
        extern bool postBlendSRGB;
        extern bool exactColorRounding;
        extern TransparencyAntialiasing transparencyAntialiasing;
@@ -392,12 +391,6 @@ namespace sw
                                N += context->depthBias;
                        }
 
-                       if(complementaryDepthBuffer)
-                       {
-                               Z = -Z;
-                               N = 1 - N;
-                       }
-
                        data->Wx16 = replicate(W * 16);
                        data->Hx16 = replicate(H * 16);
                        data->X0x16 = replicate(X0 * 16 - 8);
@@ -1735,7 +1728,6 @@ namespace sw
                        }
 
                        forceWindowed = configuration.forceWindowed;
-                       complementaryDepthBuffer = configuration.complementaryDepthBuffer;
                        postBlendSRGB = configuration.postBlendSRGB;
                        exactColorRounding = configuration.exactColorRounding;
                        forceClearRegisters = configuration.forceClearRegisters;
index c149bc3..719fb95 100644 (file)
@@ -25,7 +25,6 @@
 
 namespace sw
 {
-       extern bool complementaryDepthBuffer;
        extern bool fullPixelPositionRegister;
 
        bool precacheSetup = false;
index db8aec0..4871066 100644 (file)
@@ -36,7 +36,6 @@
 namespace sw
 {
        extern bool quadLayoutEnabled;
-       extern bool complementaryDepthBuffer;
        extern TranscendentalPrecision logPrecision;
 
        void Surface::Buffer::write(int x, int y, int z, const Color<float> &color)
@@ -2764,11 +2763,6 @@ namespace sw
                }
                else   // Quad layout
                {
-                       if(complementaryDepthBuffer)
-                       {
-                               depth = 1 - depth;
-                       }
-
                        float *buffer = (float*)lockInternal(0, 0, 0, lock, PUBLIC);
 
                        int oddX0 = (x0 & ~1) * 2 + (x0 & 1);
index db3a97d..3471ff1 100644 (file)
@@ -422,7 +422,6 @@ namespace sw
                html += "<table>\n";
                html += "<tr><td>Disable SwiftConfig server:</td><td><input name = 'disableServer' type='checkbox'" + (config.disableServer == true ? checked : empty) + " title='If checked disables the web browser based control panel.'></td></tr>";
                html += "<tr><td>Force windowed mode:</td><td><input name = 'forceWindowed' type='checkbox'" + (config.forceWindowed == true ? checked : empty) + " title='If checked prevents the application from switching to full-screen mode.'></td></tr>";
-               html += "<tr><td>Complementary depth buffer:</td><td><input name = 'complementaryDepthBuffer' type='checkbox'" + (config.complementaryDepthBuffer == true ? checked : empty) + " title='If checked causes 1 - z to be stored in the depth buffer.'></td></tr>";
                html += "<tr><td>Post alpha blend sRGB conversion:</td><td><input name = 'postBlendSRGB' type='checkbox'" + (config.postBlendSRGB == true ? checked : empty) + " title='If checked alpha blending is performed in linear color space.'></td></tr>";
                html += "<tr><td>Exact color rounding:</td><td><input name = 'exactColorRounding' type='checkbox'" + (config.exactColorRounding == true ? checked : empty) + " title='If checked color rounding is done at high accuracy.'></td></tr>";
                html += "<tr><td>Disable alpha display formats:</td><td><input name = 'disableAlphaMode' type='checkbox'" + (config.disableAlphaMode == true ? checked : empty) + " title='If checked the device does not advertise the A8R8G8B8 display mode.'></td></tr>";
@@ -541,7 +540,6 @@ namespace sw
                config.enableSSE4_1 = false;
                config.disableServer = false;
                config.forceWindowed = false;
-               config.complementaryDepthBuffer = false;
                config.postBlendSRGB = false;
                config.exactColorRounding = false;
                config.disableAlphaMode = false;
@@ -662,10 +660,6 @@ namespace sw
                        {
                                config.forceWindowed = true;
                        }
-                       else if(strstr(post, "complementaryDepthBuffer=on"))
-                       {
-                               config.complementaryDepthBuffer = true;
-                       }
                        else if(strstr(post, "postBlendSRGB=on"))
                        {
                                config.postBlendSRGB = true;
@@ -744,7 +738,6 @@ namespace sw
 
                config.disableServer = ini.getBoolean("Testing", "DisableServer", false);
                config.forceWindowed = ini.getBoolean("Testing", "ForceWindowed", false);
-               config.complementaryDepthBuffer = ini.getBoolean("Testing", "ComplementaryDepthBuffer", false);
                config.postBlendSRGB = ini.getBoolean("Testing", "PostBlendSRGB", false);
                config.exactColorRounding = ini.getBoolean("Testing", "ExactColorRounding", true);
                config.disableAlphaMode = ini.getBoolean("Testing", "DisableAlphaMode", false);
@@ -802,7 +795,6 @@ namespace sw
 
                ini.addValue("Testing", "DisableServer", itoa(config.disableServer));
                ini.addValue("Testing", "ForceWindowed", itoa(config.forceWindowed));
-               ini.addValue("Testing", "ComplementaryDepthBuffer", itoa(config.complementaryDepthBuffer));
                ini.addValue("Testing", "PostBlendSRGB", itoa(config.postBlendSRGB));
                ini.addValue("Testing", "ExactColorRounding", itoa(config.exactColorRounding));
                ini.addValue("Testing", "DisableAlphaMode", itoa(config.disableAlphaMode));
index f940c5d..fd7cc7d 100644 (file)
@@ -52,7 +52,6 @@ namespace sw
                        bool disableServer;
                        bool keepSystemCursor;
                        bool forceWindowed;
-                       bool complementaryDepthBuffer;
                        bool postBlendSRGB;
                        bool exactColorRounding;
                        bool disableAlphaMode;
index fd6a85c..b27fab9 100644 (file)
@@ -24,7 +24,6 @@
 
 namespace sw
 {
-       extern bool complementaryDepthBuffer;
        extern bool postBlendSRGB;
        extern bool exactColorRounding;
        extern bool forceClearRegisters;
@@ -375,14 +374,7 @@ namespace sw
 
                if(spirvShader && spirvShader->getModes().DepthReplacing)
                {
-                       if(complementaryDepthBuffer)
-                       {
-                               Z = Float4(1.0f) - oDepth;
-                       }
-                       else
-                       {
-                               Z = oDepth;
-                       }
+                       Z = oDepth;
                }
 
                Pointer<Byte> buffer;
@@ -436,44 +428,16 @@ namespace sw
                        zTest = CmpNEQ(zValue, Z);
                        break;
                case VK_COMPARE_OP_LESS:
-                       if(complementaryDepthBuffer)
-                       {
-                               zTest = CmpLT(zValue, Z);
-                       }
-                       else
-                       {
-                               zTest = CmpNLE(zValue, Z);
-                       }
+                       zTest = CmpNLE(zValue, Z);
                        break;
                case VK_COMPARE_OP_GREATER_OR_EQUAL:
-                       if(complementaryDepthBuffer)
-                       {
-                               zTest = CmpNLT(zValue, Z);
-                       }
-                       else
-                       {
-                               zTest = CmpLE(zValue, Z);
-                       }
+                       zTest = CmpLE(zValue, Z);
                        break;
                case VK_COMPARE_OP_LESS_OR_EQUAL:
-                       if(complementaryDepthBuffer)
-                       {
-                               zTest = CmpLE(zValue, Z);
-                       }
-                       else
-                       {
-                               zTest = CmpNLT(zValue, Z);
-                       }
+                       zTest = CmpNLT(zValue, Z);
                        break;
                case VK_COMPARE_OP_GREATER:
-                       if(complementaryDepthBuffer)
-                       {
-                               zTest = CmpNLE(zValue, Z);
-                       }
-                       else
-                       {
-                               zTest = CmpLT(zValue, Z);
-                       }
+                       zTest = CmpLT(zValue, Z);
                        break;
                default:
                        ASSERT(false);
@@ -529,14 +493,7 @@ namespace sw
 
                if(spirvShader && spirvShader->getModes().DepthReplacing)
                {
-                       if(complementaryDepthBuffer)
-                       {
-                               Z = Float4(1.0f) - oDepth;
-                       }
-                       else
-                       {
-                               Z = oDepth;
-                       }
+                       Z = oDepth;
                }
 
                Pointer<Byte> buffer;
index 0456c6f..aee3e48 100644 (file)
@@ -23,7 +23,6 @@
 
 namespace sw
 {
-       extern bool complementaryDepthBuffer;
        extern TranscendentalPrecision logPrecision;
        extern bool leadingVertexFirst;
 
@@ -439,11 +438,6 @@ namespace sw
                                        Float bias = Max(Abs(Float(A.x)), Abs(Float(B.x)));
                                        bias *= *Pointer<Float>(data + OFFSET(DrawData,slopeDepthBias));
 
-                                       if(complementaryDepthBuffer)
-                                       {
-                                               bias = -bias;
-                                       }
-
                                        c += bias;
                                }