From 887c669c288a8aeb432e9b6e9cd0c781bd14faf5 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Sun, 14 Dec 2014 21:50:46 +0100 Subject: [PATCH] GeometryShaderGen: Redefine gl_InvocationID so we can use the same variable name in both backends. --- Source/Core/VideoCommon/GeometryShaderGen.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Source/Core/VideoCommon/GeometryShaderGen.cpp b/Source/Core/VideoCommon/GeometryShaderGen.cpp index 814ad9c075..d0e9eb7144 100644 --- a/Source/Core/VideoCommon/GeometryShaderGen.cpp +++ b/Source/Core/VideoCommon/GeometryShaderGen.cpp @@ -59,6 +59,9 @@ static inline void GenerateGeometryShader(T& out, u32 primitive_type, API_TYPE A if (ApiType == API_OPENGL) { + if (g_ActiveConfig.backend_info.bSupportsGSInstancing) + out.Write("#define InstanceID gl_InvocationID\n"); + out.Write("centroid in VS_OUTPUT o[3];\n"); out.Write("centroid out VS_OUTPUT vs;\n"); out.Write("flat out int layer;\n"); @@ -91,12 +94,7 @@ static inline void GenerateGeometryShader(T& out, u32 primitive_type, API_TYPE A // If the GPU supports invocation we don't need a for loop and can simply use the // invocation identifier to determine which layer we're rendering. if (g_ActiveConfig.backend_info.bSupportsGSInstancing) - { - if (ApiType == API_OPENGL) - out.Write("\tint eye = gl_InvocationID;\n"); - else - out.Write("\tint eye = InstanceID;\n"); - } + out.Write("\tint eye = InstanceID;\n"); else out.Write("\tfor (int eye = 0; eye < %d; ++eye) {\n", g_ActiveConfig.iStereoMode > 0 ? 2 : 1);