// Class: openfl._internal.stage3D.GLCompressedTextureFormats

var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this

$global.Object.defineProperty(exports, "__esModule", {value: true});

var __map_reserved = {};

// Imports

var $hxClasses = require("./../../../hxClasses_stub").default;
var $import = require("./../../../import_stub").default;
function haxe_ds_IntMap() {return require("./../../../haxe/ds/IntMap");}

// Constructor

var GLCompressedTextureFormats = function(gl) {
	this.__formatMapAlpha = new (haxe_ds_IntMap().default)();
	this.__formatMap = new (haxe_ds_IntMap().default)();
	this.checkDXT(gl);
	this.checkETC1(gl);
	this.checkPVRTC(gl);
}

// Meta

GLCompressedTextureFormats.__name__ = ["openfl","_internal","stage3D","GLCompressedTextureFormats"];
GLCompressedTextureFormats.prototype = {
	checkDXT: function(gl) {
		var compressedExtension = gl.getExtension("WEBGL_compressed_texture_s3tc");
		if(compressedExtension != null) {
			var v = compressedExtension.COMPRESSED_RGBA_S3TC_DXT1_EXT;
			this.__formatMap.set(0,v);
			var v1 = compressedExtension.COMPRESSED_RGBA_S3TC_DXT5_EXT;
			this.__formatMapAlpha.set(0,v1);
		}
	},
	checkETC1: function(gl) {
		var compressedExtension = gl.getExtension("WEBGL_compressed_texture_etc1");
		if(compressedExtension != null) {
			var v = compressedExtension.COMPRESSED_RGB_ETC1_WEBGL;
			this.__formatMap.set(2,v);
			var v1 = compressedExtension.COMPRESSED_RGB_ETC1_WEBGL;
			this.__formatMapAlpha.set(2,v1);
		}
	},
	checkPVRTC: function(gl) {
		var compressedExtension = gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");
		if(compressedExtension != null) {
			var v = compressedExtension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
			this.__formatMap.set(1,v);
			var v1 = compressedExtension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
			this.__formatMapAlpha.set(1,v1);
		}
	},
	toTextureFormat: function(alpha,gpuFormat) {
		if(alpha) {
			return this.__formatMapAlpha.get(gpuFormat);
		} else {
			return this.__formatMap.get(gpuFormat);
		}
	}
};
GLCompressedTextureFormats.prototype.__class__ = $hxClasses["openfl._internal.stage3D.GLCompressedTextureFormats"] = GLCompressedTextureFormats;

// Init



// Statics




// Export

exports.default = GLCompressedTextureFormats;