diff --git a/GPU/Directx9/StateMappingDX9.cpp b/GPU/Directx9/StateMappingDX9.cpp index 32a5884411..98c9479c23 100644 --- a/GPU/Directx9/StateMappingDX9.cpp +++ b/GPU/Directx9/StateMappingDX9.cpp @@ -666,18 +666,22 @@ void TransformDrawEngineDX9::ApplyDrawState(int prim) { dxstate.scissorTest.disable(); } - // Direct3D can't handle negative depth ranges, so we fix it in the projection matrix. float depthMin = vpAndScissor.depthRangeMin; float depthMax = vpAndScissor.depthRangeMax; - if (gstate_c.vpDepth != depthMax - depthMin) { - gstate_c.vpDepth = depthMax - depthMin; - vpAndScissor.dirtyProj = true; + + if (!gstate.isModeThrough()) { + // Direct3D can't handle negative depth ranges, so we fix it in the projection matrix. + if (gstate_c.vpDepth != depthMax - depthMin) { + gstate_c.vpDepth = depthMax - depthMin; + vpAndScissor.dirtyProj = true; + } + if (depthMin > depthMax) { + std::swap(depthMin, depthMax); + } + if (depthMin < 0.0f) depthMin = 0.0f; + if (depthMax > 1.0f) depthMax = 1.0f; } - if (depthMin > depthMax) { - std::swap(depthMin, depthMax); - } - if (depthMin < 0.0f) depthMin = 0.0f; - if (depthMax > 1.0f) depthMax = 1.0f; + dxstate.viewport.set(vpAndScissor.viewportX, vpAndScissor.viewportY, vpAndScissor.viewportW, vpAndScissor.viewportH, depthMin, depthMax); if (vpAndScissor.dirtyProj) { shaderManager_->DirtyUniform(DIRTY_PROJMATRIX);