summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/GeometryShaderGen.cpp
diff options
context:
space:
mode:
authorJules Blok <jules.blok@gmail.com>2014-10-26 19:17:00 +0100
committerJules Blok <jules.blok@gmail.com>2014-11-23 14:23:41 +0100
commitf6ea293027e553cf89f780ec2a1b716cc026a4b5 (patch)
tree7ff15360896c93b727b70dc311fd91530f8e6b19 /Source/Core/VideoCommon/GeometryShaderGen.cpp
parentc64486075d728b3682b77ed06d5c154fd4a5c88d (diff)
VertexShaderManager: Compute stereoscopy projection matrices.
Diffstat (limited to 'Source/Core/VideoCommon/GeometryShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/GeometryShaderGen.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Source/Core/VideoCommon/GeometryShaderGen.cpp b/Source/Core/VideoCommon/GeometryShaderGen.cpp
index 991189a27f..9f1b5b69b4 100644
--- a/Source/Core/VideoCommon/GeometryShaderGen.cpp
+++ b/Source/Core/VideoCommon/GeometryShaderGen.cpp
@@ -51,7 +51,7 @@ static inline void GenerateGeometryShader(T& out, u32 components, API_TYPE ApiTy
out.Write("%s", s_lighting_struct);
// uniforms
- /*if (ApiType == API_OPENGL)
+ if (ApiType == API_OPENGL)
out.Write("layout(std140%s) uniform VSBlock {\n", g_ActiveConfig.backend_info.bSupportsBindingLayout ? ", binding = 2" : "");
else
out.Write("cbuffer VSBlock {\n");
@@ -65,7 +65,8 @@ static inline void GenerateGeometryShader(T& out, u32 components, API_TYPE ApiTy
"\tfloat4 " I_NORMALMATRICES"[32];\n"
"\tfloat4 " I_POSTTRANSFORMMATRICES"[64];\n"
"\tfloat4 " I_DEPTHPARAMS";\n"
- "};\n");*/
+ "\tfloat4 " I_STEREOPROJECTION"[8];\n"
+ "};\n");
ShaderCode code;
char buf[16384];
@@ -79,7 +80,8 @@ static inline void GenerateGeometryShader(T& out, u32 components, API_TYPE ApiTy
out.Write("void main()\n{\n");
out.Write("\tfor (int i = 0; i < gl_in.length(); ++i) {\n");
out.Write("\t\to = v[i];\n");
- out.Write("\t\tgl_Position = gl_in[i].gl_Position;\n");
+ out.Write("\t\to.pos = float4(dot(" I_STEREOPROJECTION"[gl_InvocationID * 4 + 0], v[i].rawpos), dot(" I_STEREOPROJECTION"[gl_InvocationID * 4 + 1], v[i].rawpos), dot(" I_STEREOPROJECTION"[gl_InvocationID * 4 + 2], v[i].rawpos), dot(" I_STEREOPROJECTION"[gl_InvocationID * 4 + 3], v[i].rawpos)); \n");
+ out.Write("\t\tgl_Position = o.pos;\n");
out.Write("\t\tgl_Layer = gl_InvocationID;\n");
out.Write("\t\tEmitVertex();\n");
out.Write("\t}\n");