From cc2227fbc3fdb22d19036a7721b30b099190b716 Mon Sep 17 00:00:00 2001 From: Yuriy O'Donnell Date: Sat, 25 Oct 2014 00:26:28 +0200 Subject: [PATCH] D3D: Replaced shader-based depth range remap with viewport This fixes UI rendering in some games mentioned in https://code.google.com/p/dolphin-emu/issues/detail?id=7785 --- Source/Core/VideoBackends/D3D/Render.cpp | 4 ++-- Source/Core/VideoCommon/VertexShaderGen.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 0441e63d7b..6705364189 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -487,8 +487,8 @@ void Renderer::SetViewport() // Some games set invalid values for z-min and z-max so fix them to the max and min allowed and let the shaders do this work D3D11_VIEWPORT vp = CD3D11_VIEWPORT(X, Y, Wd, Ht, - 0.f, // (xfmem.viewport.farZ - xfmem.viewport.zRange) / 16777216.0f; - 1.f); // xfmem.viewport.farZ / 16777216.0f; + (xfmem.viewport.farZ - xfmem.viewport.zRange) / 16777216.0f, + xfmem.viewport.farZ / 16777216.0f); D3D::context->RSSetViewports(1, &vp); } diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp index 24c6f39f46..c0faf21000 100644 --- a/Source/Core/VideoCommon/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/VertexShaderGen.cpp @@ -405,7 +405,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ //if not early z culling will improve speed if (api_type == API_D3D) { - out.Write("o.pos.z = " I_DEPTHPARAMS".x * o.pos.w + o.pos.z * " I_DEPTHPARAMS".y;\n"); + out.Write("o.pos.z = o.pos.w + o.pos.z;\n"); } else // OGL {