Kaynağa Gözat

further depth-bias fixes

David Rose 17 yıl önce
ebeveyn
işleme
2f47cbbb17

+ 7 - 0
panda/src/dxgsg9/config_dxgsg9.cxx

@@ -80,6 +80,13 @@ ConfigVariableBool dx_broken_depth_bias
           "to just leave this set, since the workaround seems to be "
           "to just leave this set, since the workaround seems to be "
           "sufficient for all cases."));
           "sufficient for all cases."));
 
 
+ConfigVariableDouble dx_depth_bias_scale
+("dx-depth-bias-scale", 0.000001,
+ PRC_DESC("If depth bias is not directly supported by the graphics driver "
+          "(or if dx-broken-depth-bias is set true), this configures the "
+          "amount by which we slide the viewport back to achieve the effect "
+          "of a depth bias.  It should generally be a small number."));
+
 #ifndef NDEBUG
 #ifndef NDEBUG
 // debugging flag
 // debugging flag
 // values are same as D3DCULL enumtype, 0 - no force, 1 - force none, 2 - force CW, 3 - force CCW
 // values are same as D3DCULL enumtype, 0 - no force, 1 - force none, 2 - force CW, 3 - force CCW

+ 1 - 0
panda/src/dxgsg9/config_dxgsg9.h

@@ -34,6 +34,7 @@ extern ConfigVariableInt dx_multisample_antialiasing_level;
 extern ConfigVariableBool dx_use_triangle_mipgen_filter;
 extern ConfigVariableBool dx_use_triangle_mipgen_filter;
 extern ConfigVariableBool dx_broken_max_index;
 extern ConfigVariableBool dx_broken_max_index;
 extern ConfigVariableBool dx_broken_depth_bias;
 extern ConfigVariableBool dx_broken_depth_bias;
+extern ConfigVariableDouble dx_depth_bias_scale;
 
 
 // debug flags we might want to use in full optimized build
 // debug flags we might want to use in full optimized build
 extern ConfigVariableBool dx_ignore_mipmaps;
 extern ConfigVariableBool dx_ignore_mipmaps;

+ 1 - 1
panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx

@@ -3143,7 +3143,7 @@ do_issue_depth_offset() {
     // DirectX depth bias isn't directly supported by the driver.
     // DirectX depth bias isn't directly supported by the driver.
     // Cheese a depth bias effect by sliding the viewport backward a
     // Cheese a depth bias effect by sliding the viewport backward a
     // bit.
     // bit.
-    static const float bias_scale = 0.0001;
+    static const float bias_scale = dx_depth_bias_scale;
     D3DVIEWPORT9 vp = _current_viewport;
     D3DVIEWPORT9 vp = _current_viewport;
     vp.MinZ -= bias_scale * offset;
     vp.MinZ -= bias_scale * offset;
     vp.MaxZ -= bias_scale * offset;
     vp.MaxZ -= bias_scale * offset;