st/nine: Remove NINED3DRS_ZBIASSCALE

It wasn't giving the expected result.

This fixes some object being transparents
in games like FEAR.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
This commit is contained in:
Axel Davy
2015-08-13 19:24:02 +02:00
parent 6379a28aa7
commit bae2c7c154
3 changed files with 12 additions and 23 deletions
+11 -1
View File
@@ -117,7 +117,17 @@ nine_convert_rasterizer_state(struct pipe_rasterizer_state *rast_state, const DW
asfloat(rs[D3DRS_POINTSIZE_MIN]),
asfloat(rs[D3DRS_POINTSIZE_MAX]));
}
rast.offset_units = asfloat(rs[D3DRS_DEPTHBIAS]) * asfloat(rs[NINED3DRS_ZBIASSCALE]);
/* offset_units has the ogl/d3d11 meaning.
* d3d9: offset = scale * dz + bias
* ogl/d3d11: offset = scale * dz + r * bias
* with r implementation dependant and is supposed to be
* the smallest value the depth buffer format can hold.
* In practice on current and past hw it seems to be 2^-23
* for all formats except float formats where it varies depending
* on the content.
* For now use 1 << 23, but in the future perhaps add a way in gallium
* to get r for the format or get the gallium behaviour */
rast.offset_units = asfloat(rs[D3DRS_DEPTHBIAS]) * (float)(1 << 23);
rast.offset_scale = asfloat(rs[D3DRS_SLOPESCALEDEPTHBIAS]);
/* rast.offset_clamp = 0.0f; */
@@ -496,26 +496,6 @@ update_framebuffer(struct NineDevice9 *device)
pipe->set_framebuffer_state(pipe, fb); /* XXX: cso ? */
if (fb->zsbuf) {
DWORD scale;
switch (fb->zsbuf->format) {
case PIPE_FORMAT_Z32_FLOAT:
case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
scale = fui(1.0f);
break;
case PIPE_FORMAT_Z16_UNORM:
scale = fui((float)(1 << 16));
break;
default:
scale = fui((float)(1 << 24));
break;
}
if (state->rs[NINED3DRS_ZBIASSCALE] != scale) {
state->rs[NINED3DRS_ZBIASSCALE] = scale;
state->changed.group |= NINE_STATE_RASTERIZER;
}
}
return state->changed.group;
}
+1 -2
View File
@@ -33,8 +33,7 @@
#define NINED3DRS_VSPOINTSIZE (D3DRS_BLENDOPALPHA + 1)
#define NINED3DRS_RTMASK (D3DRS_BLENDOPALPHA + 2)
#define NINED3DRS_ZBIASSCALE (D3DRS_BLENDOPALPHA + 3)
#define NINED3DRS_ALPHACOVERAGE (D3DRS_BLENDOPALPHA + 4)
#define NINED3DRS_ALPHACOVERAGE (D3DRS_BLENDOPALPHA + 3)
#define D3DRS_LAST D3DRS_BLENDOPALPHA
#define NINED3DRS_LAST NINED3DRS_ALPHACOVERAGE /* 213 */