1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-13 19:29:14 +01:00

[d3d9] Don't arbitrarily set fog scale to 0

The Witcher 1 sets FOGSTART == FOGEND together with LINEAR fog mode, in
which case we previously set fog_scale to 0 and therefore incorrectly
override the pixel color with the fog color.

Fixes #1401.
This commit is contained in:
Philip Rebohle 2020-02-06 00:36:57 +01:00 committed by Joshie
parent 87dd8f0122
commit 06809587e8
2 changed files with 1 additions and 4 deletions

View File

@ -4589,9 +4589,6 @@ namespace dxvk {
float start = bit::cast<float>(rs[D3DRS_FOGSTART]);
float scale = 1.0f / (end - start);
if (!std::isfinite(scale))
scale = 0.0f;
UpdatePushConstant<offsetof(D3D9RenderStateInfo, fogScale), sizeof(float)>(&scale);
}
else if constexpr (Item == D3D9RenderStateItem::PointSize) {

View File

@ -129,7 +129,7 @@ namespace dxvk {
case D3DFOG_LINEAR: {
uint32_t fogFactor = spvModule.opFSub(floatType, fogEnd, depth);
fogFactor = spvModule.opFMul(floatType, fogFactor, fogScale);
fogFactor = spvModule.opFClamp(floatType, fogFactor, spvModule.constf32(0.0f), spvModule.constf32(1.0f));
fogFactor = spvModule.opNClamp(floatType, fogFactor, spvModule.constf32(0.0f), spvModule.constf32(1.0f));
return fogFactor;
}