gpu: pack 2D transforms in vec4 values

Instead of separate 2d scale and transform, pack them into a single
4d value.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-02-27 17:38:06 +01:00
parent 1f117d8de0
commit c34c350a52
7 changed files with 73 additions and 109 deletions
+4 -8
View File
@@ -5,11 +5,9 @@
precision highp float;
layout(binding = 0) uniform Block {
vec4 transform;
vec4 uvTransform;
float z;
vec2 scale;
vec2 offset;
vec2 uvScale;
vec2 uvOffset;
};
layout(location = 0) in vec2 pos;
@@ -19,9 +17,7 @@ layout(location = 1) in vec2 uv;
layout(location = 0) out vec2 vUV;
void main() {
vec2 p = pos;
p *= scale;
p += offset;
vec2 p = pos*transform.xy + transform.zw;
gl_Position = vec4(p, z, 1);
vUV = uv*uvScale + uvOffset;
vUV = uv*uvTransform.xy + uvTransform.zw;
}