diff options
Diffstat (limited to 'src/quick/scenegraph/shaders_ng/styledtext.vert')
-rw-r--r-- | src/quick/scenegraph/shaders_ng/styledtext.vert | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/quick/scenegraph/shaders_ng/styledtext.vert b/src/quick/scenegraph/shaders_ng/styledtext.vert index beadf07c79..5e0a8fa5c9 100644 --- a/src/quick/scenegraph/shaders_ng/styledtext.vert +++ b/src/quick/scenegraph/shaders_ng/styledtext.vert @@ -7,21 +7,28 @@ layout(location = 0) out vec2 sampleCoord; layout(location = 1) out vec2 shiftedSampleCoord; 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; + vec4 color; // the above must stay compatible with textmask/8bittextmask vec4 styleColor; vec2 shift; -} ubuf; - -out gl_PerVertex { vec4 gl_Position; }; +}; void main() { - sampleCoord = tCoord * ubuf.textureScale; - shiftedSampleCoord = (tCoord - ubuf.shift) * ubuf.textureScale; - vec3 dprSnapPos = floor(vCoord.xyz * ubuf.dpr + 0.5) / ubuf.dpr; - gl_Position = ubuf.matrix * vec4(dprSnapPos, vCoord.w); + sampleCoord = tCoord * textureScale; + shiftedSampleCoord = (tCoord - shift) * 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 } |