gpu/shaders: introduce toClipSpace to map to GPU native clip space

OpenGL use the [-1; 1] range for clip depths, Direct3D [0; 1].
Use toClipSpace to encapsulate the difference.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-02-27 18:00:24 +01:00
parent c34c350a52
commit 8dce81d8fd
4 changed files with 47 additions and 27 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ layout(location = 1) in vec2 uv;
layout(location = 1) out vec2 vUV;
void main() {
gl_Position = vec4(pos*transform.xy + transform.zw, z, 1);
gl_Position = toClipSpace(vec4(pos*transform.xy + transform.zw, z, 1));
vUV = uv*uvTransform.xy + uvTransform.zw;
vec3[2] fboTrans = fboTextureTransform();
vec3 uv3 = transform3x2(fboTrans, vec3(uv, 1.0));