Bläddra i källkod

added BC6H and BC7 support

Nicolas Cannasse 2 år sedan
förälder
incheckning
893196ef85
1 ändrade filer med 10 tillägg och 5 borttagningar
  1. 10 5
      h3d/impl/GlDriver.hx

+ 10 - 5
h3d/impl/GlDriver.hx

@@ -163,14 +163,14 @@ class GlDriver extends Driver {
 
 		#if hlsdl
 		hasMultiIndirect = gl.getConfigParameter(0) > 0;
-		maxCompressedTexturesSupport = 3;
+		maxCompressedTexturesSupport = 7;
 		var driver = getDriverName(false).toLowerCase();
 		isIntelGpu = ~/intel.*graphics/.match(driver);
 		#end
 
 		#if hlmesa
 		hasMultiIndirect = true;
-		maxCompressedTexturesSupport = 3;
+		maxCompressedTexturesSupport = 7;
 		#end
 
 		var v : String = gl.getParameter(GL.VERSION);
@@ -811,8 +811,8 @@ class GlDriver extends Driver {
 		case GL.RGB10_A2: GL.RGBA;
 		case GL.RED, GL.R8, GL.R16F, GL.R32F, 0x822A: GL.RED;
 		case GL.RG, GL.RG8, GL.RG16F, GL.RG32F, 0x822C: GL.RG;
-		case GL.RGB16F, GL.RGB32F, 0x8054: GL.RGB;
-		case 0x83F1, 0x83F2, 0x83F3, 0x805B: GL.RGBA;
+		case GL.RGB16F, GL.RGB32F, 0x8054, 0x8E8F: GL.RGB;
+		case 0x83F1, 0x83F2, 0x83F3, 0x805B, 0x8E8C: GL.RGBA;
 		default: throw "Invalid format " + t.internalFmt;
 		}
 	}
@@ -905,6 +905,8 @@ class GlDriver extends Driver {
 			case 1: tt.internalFmt = 0x83F1; // COMPRESSED_RGBA_S3TC_DXT1_EXT
 			case 2:	tt.internalFmt = 0x83F2; // COMPRESSED_RGBA_S3TC_DXT3_EXT
 			case 3: tt.internalFmt = 0x83F3; // COMPRESSED_RGBA_S3TC_DXT5_EXT
+			case 6: tt.internalFmt = 0x8E8F; // COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT
+			case 7: tt.internalFmt = 0x8E8C; // COMPRESSED_RGBA_BPTC_UNORM
 			default: throw "Unsupported texture format "+t.format;
 			}
 		default:
@@ -1644,8 +1646,11 @@ class GlDriver extends Driver {
 	function makeFeatures() {
 		for( f in Type.allEnums(Feature) )
 			features.set(f,checkFeature(f));
-		if( gl.getExtension("WEBGL_compressed_texture_s3tc") != null )
+		if( gl.getExtension("WEBGL_compressed_texture_s3tc") != null ) {
 			maxCompressedTexturesSupport = 3;
+			if( gl.getExtension("EXT_texture_compression_bptc") != null )
+				maxCompressedTexturesSupport = 7;
+		}
 		if( glES < 3 )
 			gl.getExtension("WEBGL_depth_texture");
 		has16Bits = gl.getExtension("EXT_texture_norm16") != null; // 16 bit textures