summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2016-08-13 00:54:55 +1000
committerStenzek <stenzek@gmail.com>2016-10-01 01:09:11 +1000
commit75e4e42e56bbb6a89e373dc03407cdafb19b22d5 (patch)
tree80a4c5cee99c62b6fb0ae3e39ceab5707e655e66 /Source/Core
parent7f3a876aae27e8b49884de5b53c399fcd5414173 (diff)
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.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoCommon/GeometryShaderGen.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/GeometryShaderGen.cpp b/Source/Core/VideoCommon/GeometryShaderGen.cpp
index 6aefdf3e69..99e546a363 100644
--- a/Source/Core/VideoCommon/GeometryShaderGen.cpp
+++ b/Source/Core/VideoCommon/GeometryShaderGen.cpp
@@ -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)