Przeglądaj źródła

Add conditionals in default shaders for using medium precision

Some devices have problems with high precision floats. I have tested
Nexus 4 and Nexus 7 with Android 4.4 having lightning artifacts when
using highp floats but work fine with mediump.
Üstün Ergenoğlu 12 lat temu
rodzic
commit
2a771195fc

+ 4 - 0
gameplay/res/shaders/colored.frag

@@ -1,6 +1,10 @@
 #ifdef OPENGL_ES
+#ifdef OPENGL_ES_MEDIUMP
+precision mediump float;
+#else
 precision highp float;
 #endif
+#endif
 
 #ifndef DIRECTIONAL_LIGHT_COUNT
 #define DIRECTIONAL_LIGHT_COUNT 0

+ 4 - 0
gameplay/res/shaders/font.frag

@@ -1,7 +1,11 @@
 #ifdef OPENGL_ES
 #extension GL_OES_standard_derivatives : enable
+#ifdef OPENGL_ES_MEDIUMP
+precision mediump float;
+#else
 precision highp float;
 #endif
+#endif
 
 ///////////////////////////////////////////////////////////
 // Uniforms

+ 4 - 0
gameplay/res/shaders/sprite.frag

@@ -1,6 +1,10 @@
 #ifdef OPENGL_ES
+#ifdef OPENGL_ES_MEDIUMP
+precision mediump float;
+#else
 precision highp float;
 #endif
+#endif
 
 ///////////////////////////////////////////////////////////
 // Uniforms

+ 4 - 0
gameplay/res/shaders/terrain.frag

@@ -1,6 +1,10 @@
 #ifdef OPENGL_ES
+#ifdef OPENGL_ES_MEDIUMP
+precision mediump float;
+#else
 precision highp float;
 #endif
+#endif
 
 #ifndef DIRECTIONAL_LIGHT_COUNT
 #define DIRECTIONAL_LIGHT_COUNT 0

+ 4 - 0
gameplay/res/shaders/textured.frag

@@ -1,6 +1,10 @@
 #ifdef OPENGL_ES
+#ifdef OPENGL_ES_MEDIUMP
+precision mediump float;
+#else
 precision highp float;
 #endif
+#endif
 
 #ifndef DIRECTIONAL_LIGHT_COUNT
 #define DIRECTIONAL_LIGHT_COUNT 0