further depth-bias fixes

This commit is contained in:
David Rose 2009-01-16 02:56:51 +00:00
parent cef2a5c8b2
commit 2f47cbbb17
3 changed files with 9 additions and 1 deletions

View File

@ -80,6 +80,13 @@ ConfigVariableBool dx_broken_depth_bias
"to just leave this set, since the workaround seems to be "
"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
// debugging flag
// values are same as D3DCULL enumtype, 0 - no force, 1 - force none, 2 - force CW, 3 - force CCW

View File

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

View File

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