Browse Source

Fix validating glsl1 shaders using array textures on GLES3

Alex Szpakowski 4 years ago
parent
commit
48a13d443b
1 changed files with 8 additions and 5 deletions
  1. 8 5
      src/modules/graphics/wrap_GraphicsShader.lua

+ 8 - 5
src/modules/graphics/wrap_GraphicsShader.lua

@@ -54,8 +54,11 @@ GLSL.SYNTAX = [[
 	#define DepthCubeImage samplerCubeShadow
 #endif
 #define extern uniform
-#if defined(GL_EXT_texture_array) && (!defined(GL_ES) || __VERSION__ > 100)
-#define texture_arrays_enabled
+#if defined(GL_EXT_texture_array) && (!defined(GL_ES) || __VERSION__ > 100 || defined(GL_OES_gpu_shader5))
+// Only used when !GLSLES1 to work around Ouya driver bug. But we still want it
+// enabled for glslang validation when glsl 1-on-3 is used, so also enable it if
+// OES_gpu_shader5 exists.
+#define LOVE_EXT_TEXTURE_ARRAY_ENABLED
 #extension GL_EXT_texture_array : enable
 #endif
 #ifdef GL_OES_texture_3D
@@ -86,7 +89,7 @@ uniform LOVE_HIGHP_OR_MEDIUMP vec4 love_ScreenSize;
 
 GLSL.FUNCTIONS = [[
 #ifdef GL_ES
-	#if __VERSION__ >= 300 || defined(texture_arrays_enabled)
+	#if __VERSION__ >= 300 || defined(LOVE_EXT_TEXTURE_ARRAY_ENABLED)
 		precision lowp sampler2DArray;
 	#endif
 	#if __VERSION__ >= 300 || defined(GL_OES_texture_3D)
@@ -122,7 +125,7 @@ GLSL.FUNCTIONS = [[
 	#if __VERSION__ > 100 || defined(GL_OES_texture_3D)
 		vec4 Texel(sampler3D s, vec3 c) { return love_texture3D(s, c); }
 	#endif
-	#if __VERSION__ >= 130 || defined(texture_arrays_enabled)
+	#if __VERSION__ >= 130 || defined(LOVE_EXT_TEXTURE_ARRAY_ENABLED)
 		vec4 Texel(sampler2DArray s, vec3 c) { return love_texture2DArray(s, c); }
 	#endif
 	#ifdef PIXEL
@@ -131,7 +134,7 @@ GLSL.FUNCTIONS = [[
 		#if __VERSION__ > 100 || defined(GL_OES_texture_3D)
 			vec4 Texel(sampler3D s, vec3 c, float b) { return love_texture3D(s, c, b); }
 		#endif
-		#if __VERSION__ >= 130 || defined(texture_arrays_enabled)
+		#if __VERSION__ >= 130 || defined(LOVE_EXT_TEXTURE_ARRAY_ENABLED)
 			vec4 Texel(sampler2DArray s, vec3 c, float b) { return love_texture2DArray(s, c, b); }
 		#endif
 	#endif