github.com/cybriq/giocore@v0.0.7-0.20210703034601-cfb9cb5f3900/gpu/shaders/cover.vert (about) 1 #version 310 es 2 3 // SPDX-License-Identifier: Unlicense OR MIT 4 5 #extension GL_GOOGLE_include_directive : enable 6 7 precision highp float; 8 9 #include "common.h" 10 11 layout(binding = 0) uniform Block { 12 vec4 transform; 13 vec4 uvCoverTransform; 14 vec4 uvTransformR1; 15 vec4 uvTransformR2; 16 float z; 17 } _block; 18 19 layout(location = 0) in vec2 pos; 20 21 layout(location = 0) out vec2 vCoverUV; 22 23 layout(location = 1) in vec2 uv; 24 layout(location = 1) out vec2 vUV; 25 26 void main() { 27 gl_Position = toClipSpace(vec4(pos*_block.transform.xy + _block.transform.zw, _block.z, 1)); 28 vUV = transform3x2(m3x2(_block.uvTransformR1.xyz, _block.uvTransformR2.xyz), vec3(uv,1)).xy; 29 vec3 uv3 = transform3x2(fboTextureTransform, vec3(uv, 1.0)); 30 vCoverUV = (uv3*vec3(_block.uvCoverTransform.xy, 1.0)+vec3(_block.uvCoverTransform.zw, 0.0)).xy; 31 }