diff options
Diffstat (limited to 'src/quick/scenegraph/shaders_ng/textmask.vert')
-rw-r--r-- | src/quick/scenegraph/shaders_ng/textmask.vert | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/quick/scenegraph/shaders_ng/textmask.vert b/src/quick/scenegraph/shaders_ng/textmask.vert index 9d80d5dadb..41fffa282f 100644 --- a/src/quick/scenegraph/shaders_ng/textmask.vert +++ b/src/quick/scenegraph/shaders_ng/textmask.vert @@ -6,17 +6,24 @@ layout(location = 1) in vec2 tCoord; layout(location = 0) out vec2 sampleCoord; layout(std140, binding = 0) uniform buf { - mat4 matrix; - vec4 color; + mat4 modelViewMatrix; +#if QSHADER_VIEW_COUNT >= 2 + mat4 projectionMatrix[QSHADER_VIEW_COUNT]; +#else + mat4 projectionMatrix; +#endif vec2 textureScale; float dpr; -} ubuf; - -out gl_PerVertex { vec4 gl_Position; }; + vec4 color; +}; void main() { - sampleCoord = tCoord * ubuf.textureScale; - vec3 dprSnapPos = floor(vCoord.xyz * ubuf.dpr + 0.5) / ubuf.dpr; - gl_Position = ubuf.matrix * vec4(dprSnapPos, vCoord.w); + sampleCoord = tCoord * textureScale; + vec4 xformed = modelViewMatrix * vCoord; +#if QSHADER_VIEW_COUNT >= 2 + gl_Position = projectionMatrix[gl_ViewIndex] * vec4(floor(xformed.xyz * dpr + 0.5) / dpr, xformed.w); +#else + gl_Position = projectionMatrix * vec4(floor(xformed.xyz * dpr + 0.5) / dpr, xformed.w); +#endif } |