GeometryShaderGen: Allow stereoscopy to be disabled.

Will facilitate future use of this generator for other purposes.
This commit is contained in:
Jules Blok 2014-10-27 17:38:22 +01:00
parent 80616c6e9e
commit 272ea90ca5
2 changed files with 3 additions and 2 deletions

View File

@ -44,6 +44,7 @@ static inline void GenerateGeometryShader(T& out, u32 components, API_TYPE ApiTy
if (ApiType == API_OPENGL)
{
// Insert layout parameters
uid_data->stereo = g_ActiveConfig.bStereo;
out.Write("layout(triangles, invocations = %d) in;\n", g_ActiveConfig.bStereo ? 2 : 1);
out.Write("layout(triangle_strip, max_vertices = 3) out;\n");
}
@ -83,7 +84,8 @@ static inline void GenerateGeometryShader(T& out, u32 components, API_TYPE ApiTy
out.Write("\tfor (int i = 0; i < gl_in.length(); ++i) {\n");
out.Write("\t\to = v[i];\n");
out.Write("\t\teye = gl_InvocationID;\n");
out.Write("\t\to.pos = float4(dot(" I_STEREOPROJECTION"[eye * 4 + 0], v[i].rawpos), dot(" I_STEREOPROJECTION"[eye * 4 + 1], v[i].rawpos), dot(" I_STEREOPROJECTION"[eye * 4 + 2], v[i].rawpos), dot(" I_STEREOPROJECTION"[eye * 4 + 3], v[i].rawpos)); \n");
if (g_ActiveConfig.bStereo)
out.Write("\t\to.pos = float4(dot(" I_STEREOPROJECTION"[eye * 4 + 0], v[i].rawpos), dot(" I_STEREOPROJECTION"[eye * 4 + 1], v[i].rawpos), dot(" I_STEREOPROJECTION"[eye * 4 + 2], v[i].rawpos), dot(" I_STEREOPROJECTION"[eye * 4 + 3], v[i].rawpos)); \n");
out.Write("\t\tgl_Position = o.pos;\n");
out.Write("\t\tgl_Layer = eye;\n");
out.Write("\t\tEmitVertex();\n");

View File

@ -13,7 +13,6 @@ struct geometry_shader_uid_data
{
u32 NumValues() const { return sizeof(geometry_shader_uid_data); }
u32 components : 23;
u32 stereo : 1;
};