Forráskód Böngészése

remove sampler2dArray precision

Nicolas Cannasse 3 éve
szülő
commit
233112cbaf
1 módosított fájl, 12 hozzáadás és 9 törlés
  1. 12 9
      hxsl/GlslOut.hx

+ 12 - 9
hxsl/GlslOut.hx

@@ -273,9 +273,15 @@ class GlslOut {
 			// else
 			// else
 				return "texelFetch";
 				return "texelFetch";
 		case TextureSize:
 		case TextureSize:
-			decl("vec2 _textureSize(sampler2D sampler, int lod) { return vec2(textureSize(sampler, lod)); }");
-			decl("vec3 _textureSize(sampler2DArray sampler, int lod) { return vec3(textureSize(sampler, lod)); }");
-			decl("vec2 _textureSize(samplerCube sampler, int lod) { return vec2(textureSize(sampler, lod)); }");
+			switch( args[0].t ) {
+			case TSampler2D, TChannel(_):
+				decl("vec2 _textureSize(sampler2D sampler, int lod) { return vec2(textureSize(sampler, lod)); }");
+			case TSamplerCube:
+				decl("vec2 _textureSize(samplerCube sampler, int lod) { return vec2(textureSize(sampler, lod)); }");
+			case TSampler2DArray:
+				decl("vec3 _textureSize(sampler2DArray sampler, int lod) { return vec3(textureSize(sampler, lod)); }");
+			default:
+			}
 			return "_textureSize";
 			return "_textureSize";
 		case Mod if( rt == TInt && isES ):
 		case Mod if( rt == TInt && isES ):
 			decl("int _imod( int x, int y ) { return int(mod(float(x),float(y))); }");
 			decl("int _imod( int x, int y ) { return int(mod(float(x),float(y))); }");
@@ -656,14 +662,11 @@ class GlslOut {
 		if( s.funs.length != 1 ) throw "assert";
 		if( s.funs.length != 1 ) throw "assert";
 		var f = s.funs[0];
 		var f = s.funs[0];
 		isVertex = f.kind == Vertex;
 		isVertex = f.kind == Vertex;
-		
-		if (isVertex) {
+
+		if (isVertex)
 			decl("precision highp float;");
 			decl("precision highp float;");
-			decl("precision highp sampler2DArray;");
-		} else {
+		else
 			decl("precision mediump float;");
 			decl("precision mediump float;");
-			decl("precision mediump sampler2DArray;");
-		}
 
 
 		initVars(s);
 		initVars(s);