gl-renderer: Use highest precision for vertex shaders

Whilst GLSL requires highp for the vertex shader stage, highp is
optional for the fragment shader.

Make sure that we work in highp by default during the vertex shader
stage, using either highp or mediump for the texcoord varying according
to what the fragment shader supports.

Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Daniel Stone 2023-02-02 21:34:17 +00:00
parent e471edb33d
commit e07be58dc4
2 changed files with 13 additions and 2 deletions

View File

@ -119,7 +119,7 @@ uniform samplerExternalOES tex;
uniform sampler2D tex;
#endif
varying vec2 v_texcoord;
varying HIGHPRECISION vec2 v_texcoord;
uniform sampler2D tex1;
uniform sampler2D tex2;
uniform float view_alpha;

View File

@ -25,10 +25,21 @@
* SOFTWARE.
*/
/* Always use high-precision for vertex calculations */
precision highp float;
#ifdef GL_FRAGMENT_PRECISION_HIGH
#define FRAG_PRECISION highp
#else
#define FRAG_PRECISION mediump
#endif
uniform mat4 proj;
attribute vec2 position;
attribute vec2 texcoord;
varying vec2 v_texcoord;
/* Match the varying precision to the fragment shader */
varying FRAG_PRECISION vec2 v_texcoord;
void main()
{