forked from joejulian/gio
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:
@@ -7,13 +7,10 @@ precision highp float;
|
||||
#include <common.inc>
|
||||
|
||||
layout(binding = 0) uniform Block {
|
||||
vec4 transform;
|
||||
vec4 uvCoverTransform;
|
||||
vec4 uvTransform;
|
||||
float z;
|
||||
vec2 scale;
|
||||
vec2 offset;
|
||||
vec2 uvCoverScale;
|
||||
vec2 uvCoverOffset;
|
||||
vec2 uvScale;
|
||||
vec2 uvOffset;
|
||||
};
|
||||
|
||||
layout(location = 0) in vec2 pos;
|
||||
@@ -24,9 +21,9 @@ layout(location = 1) in vec2 uv;
|
||||
layout(location = 1) out vec2 vUV;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(pos*scale + offset, z, 1);
|
||||
vUV = uv*uvScale + uvOffset;
|
||||
gl_Position = 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));
|
||||
vCoverUV = (uv3*vec3(uvCoverScale, 1.0)+vec3(uvCoverOffset, 0.0)).xy;
|
||||
vCoverUV = (uv3*vec3(uvCoverTransform.xy, 1.0)+vec3(uvCoverTransform.zw, 0.0)).xy;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user