SDL_Render: use high precision texcoords in ES2 shaders, when possible Fixes #5884
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
diff --git a/src/render/opengles2/SDL_shaders_gles2.c b/src/render/opengles2/SDL_shaders_gles2.c
index a1f78fd..f9a8ce3 100644
--- a/src/render/opengles2/SDL_shaders_gles2.c
+++ b/src/render/opengles2/SDL_shaders_gles2.c
@@ -60,8 +60,12 @@ static const Uint8 GLES2_Fragment_Solid[] = " \
static const Uint8 GLES2_Fragment_TextureABGR[] = " \
precision mediump float; \
uniform sampler2D u_texture; \
- varying vec4 v_color; \
- varying vec2 v_texCoord; \
+ varying vec4 v_color;\n\
+ #ifdef GL_FRAGMENT_PRECISION_HIGH\n\
+ varying highp vec2 v_texCoord;\n\
+ #else\n\
+ varying vec2 v_texCoord;\n\
+ #endif\n\
\
void main() \
{ \
@@ -74,8 +78,12 @@ static const Uint8 GLES2_Fragment_TextureABGR[] = " \
static const Uint8 GLES2_Fragment_TextureARGB[] = " \
precision mediump float; \
uniform sampler2D u_texture; \
- varying vec4 v_color; \
- varying vec2 v_texCoord; \
+ varying vec4 v_color;\n\
+ #ifdef GL_FRAGMENT_PRECISION_HIGH\n\
+ varying highp vec2 v_texCoord;\n\
+ #else\n\
+ varying vec2 v_texCoord;\n\
+ #endif\n\
\
void main() \
{ \
@@ -91,8 +99,12 @@ static const Uint8 GLES2_Fragment_TextureARGB[] = " \
static const Uint8 GLES2_Fragment_TextureRGB[] = " \
precision mediump float; \
uniform sampler2D u_texture; \
- varying vec4 v_color; \
- varying vec2 v_texCoord; \
+ varying vec4 v_color;\n\
+ #ifdef GL_FRAGMENT_PRECISION_HIGH\n\
+ varying highp vec2 v_texCoord;\n\
+ #else\n\
+ varying vec2 v_texCoord;\n\
+ #endif\n\
\
void main() \
{ \
@@ -109,8 +121,12 @@ static const Uint8 GLES2_Fragment_TextureRGB[] = " \
static const Uint8 GLES2_Fragment_TextureBGR[] = " \
precision mediump float; \
uniform sampler2D u_texture; \
- varying vec4 v_color; \
- varying vec2 v_texCoord; \
+ varying vec4 v_color;\n\
+ #ifdef GL_FRAGMENT_PRECISION_HIGH\n\
+ varying highp vec2 v_texCoord;\n\
+ #else\n\
+ varying vec2 v_texCoord;\n\
+ #endif\n\
\
void main() \
{ \
@@ -157,7 +173,11 @@ static const Uint8 GLES2_Fragment_TextureBGR[] = " \
"uniform sampler2D u_texture_u;\n" \
"uniform sampler2D u_texture_v;\n" \
"varying vec4 v_color;\n" \
+"#ifdef GL_FRAGMENT_PRECISION_HIGH\n" \
+"varying highp vec2 v_texCoord;\n" \
+"#else\n" \
"varying vec2 v_texCoord;\n" \
+"#endif\n" \
"\n" \
#define YUV_SHADER_BODY \
@@ -308,8 +328,12 @@ static const Uint8 GLES2_Fragment_TextureExternalOES[] = " \
#extension GL_OES_EGL_image_external : require\n\
precision mediump float; \
uniform samplerExternalOES u_texture; \
- varying vec4 v_color; \
- varying vec2 v_texCoord; \
+ varying vec4 v_color;\n\
+ #ifdef GL_FRAGMENT_PRECISION_HIGH\n\
+ varying highp vec2 v_texCoord;\n\
+ #else\n\
+ varying vec2 v_texCoord;\n\
+ #endif\n\
\
void main() \
{ \