ShaderGen: Work around issue with glslang and dynamic vector subscripts

Seems that vec[eye] will select vec.x no matter what the value of eye is.
This commit is contained in:
Stenzek 2016-08-13 00:54:55 +10:00
parent 7f3a876aae
commit 75e4e42e56
1 changed files with 2 additions and 1 deletions

View File

@ -240,7 +240,8 @@ ShaderCode GenerateGeometryShaderCode(APIType ApiType, const geometry_shader_uid
// the depth value. This results in objects at a distance smaller than the convergence
// distance to seemingly appear in front of the screen.
// This formula is based on page 13 of the "Nvidia 3D Vision Automatic, Best Practices Guide"
out.Write("\tf.pos.x += " I_STEREOPARAMS "[eye] * (f.pos.w - " I_STEREOPARAMS "[2]);\n");
out.Write("\tfloat hoffset = (eye == 0) ? " I_STEREOPARAMS ".x : " I_STEREOPARAMS ".y;\n");
out.Write("\tf.pos.x += hoffset * (f.pos.w - " I_STEREOPARAMS ".z);\n");
}
if (uid_data->primitive_type == PRIMITIVE_LINES)