aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/shaders_ng/sprite.vert
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/scenegraph/shaders_ng/sprite.vert')
-rw-r--r--src/quick/scenegraph/shaders_ng/sprite.vert20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/quick/scenegraph/shaders_ng/sprite.vert b/src/quick/scenegraph/shaders_ng/sprite.vert
index b76e2b206f..b693e31334 100644
--- a/src/quick/scenegraph/shaders_ng/sprite.vert
+++ b/src/quick/scenegraph/shaders_ng/sprite.vert
@@ -7,23 +7,29 @@ layout(location = 0) out vec4 fTexS;
layout(location = 1) out float progress;
layout(std140, binding = 0) uniform buf {
+#if QSHADER_VIEW_COUNT >= 2
+ mat4 matrix[QSHADER_VIEW_COUNT];
+#else
mat4 matrix;
+#endif
vec4 animPos; // x,y, x,y (two frames for interpolation)
vec3 animData; // w,h(premultiplied of anim), interpolation progress
float opacity;
-} ubuf;
-
-out gl_PerVertex { vec4 gl_Position; };
+};
void main()
{
- progress = ubuf.animData.z;
+ progress = animData.z;
// Calculate frame location in texture
- fTexS.xy = ubuf.animPos.xy + vTex.xy * ubuf.animData.xy;
+ fTexS.xy = animPos.xy + vTex.xy * animData.xy;
// Next frame is also passed, for interpolation
- fTexS.zw = ubuf.animPos.zw + vTex.xy * ubuf.animData.xy;
+ fTexS.zw = animPos.zw + vTex.xy * animData.xy;
- gl_Position = ubuf.matrix * vec4(vPos.x, vPos.y, 0, 1);
+#if QSHADER_VIEW_COUNT >= 2
+ gl_Position = matrix[gl_ViewIndex] * vec4(vPos.x, vPos.y, 0, 1);
+#else
+ gl_Position = matrix * vec4(vPos.x, vPos.y, 0, 1);
+#endif
}