From acc65ee60807d7ec605f85bc101a4dc9a9a63e32 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Sat, 1 Nov 2014 23:55:04 +0100 Subject: [PATCH] GeometryShader: Replicate missing position manipulations from vertex shader. --- Source/Core/VideoCommon/GeometryShaderGen.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/Core/VideoCommon/GeometryShaderGen.cpp b/Source/Core/VideoCommon/GeometryShaderGen.cpp index 57fc4b7d8b..8260ed5f05 100644 --- a/Source/Core/VideoCommon/GeometryShaderGen.cpp +++ b/Source/Core/VideoCommon/GeometryShaderGen.cpp @@ -86,6 +86,16 @@ static inline void GenerateGeometryShader(T& out, u32 components, API_TYPE ApiTy if (g_ActiveConfig.iStereoMode > 0) out.Write("\t\to.pos = float4(dot(stereoproj, v[i].rawpos), dot(" I_PROJECTION"[1], v[i].rawpos), dot(" I_PROJECTION"[2], v[i].rawpos), dot(" I_PROJECTION"[3], v[i].rawpos)); \n"); + if (ApiType == API_D3D) + { + out.Write("\t\to.pos.z = " I_DEPTHPARAMS".x * o.pos.w + o.pos.z * " I_DEPTHPARAMS".y;\n"); + } + else // OGL + { + out.Write("\t\to.pos.z = o.pos.w + o.pos.z * 2.0;\n"); + } + + out.Write("\t\to.pos.xy = o.pos.xy - " I_DEPTHPARAMS".zw;\n"); out.Write("\t\tgl_Position = o.pos;\n"); out.Write("\t\tEmitVertex();\n"); out.Write("\t}\n");