// Class: openfl._internal.stage3D._AGALConverter.DestRegister

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 openfl__$internal_stage3D__$AGALConverter_ProgramType() {return require("./../../../../openfl/_internal/stage3D/_AGALConverter/ProgramType");}
function openfl__$internal_stage3D_AGALConverter() {return require("./../../../../openfl/_internal/stage3D/AGALConverter");}

// Constructor

var DestRegister = function() {
}

// Meta

DestRegister.__name__ = ["openfl","_internal","stage3D","_AGALConverter","DestRegister"];
DestRegister.prototype = {
	getWriteMask: function() {
		var str = ".";
		if((this.mask & 1) != 0) {
			str += "x";
		}
		if((this.mask & 2) != 0) {
			str += "y";
		}
		if((this.mask & 4) != 0) {
			str += "z";
		}
		if((this.mask & 8) != 0) {
			str += "w";
		}
		return str;
	},
	toGLSL: function(useMask) {
		if(useMask == null) {
			useMask = true;
		}
		var str;
		if(this.type == 3) {
			if(this.programType == (openfl__$internal_stage3D__$AGALConverter_ProgramType().default).VERTEX) {
				str = "gl_Position";
			} else {
				str = "gl_FragColor";
			}
		} else {
			str = (openfl__$internal_stage3D_AGALConverter().default).prefixFromType(this.type,this.programType) + this.n;
		}
		if(useMask && this.mask != 15) {
			str += this.getWriteMask();
		}
		return str;
	}
};
DestRegister.prototype.__class__ = $hxClasses["openfl._internal.stage3D._AGALConverter.DestRegister"] = DestRegister;

// Init



// Statics

DestRegister.parse = function(v,programType) {
	var dr = new DestRegister();
	dr.programType = programType;
	dr.type = v >>> 24 & 15;
	dr.mask = v >>> 16 & 15;
	dr.n = v & 65535;
	return dr;
}


// Export

exports.default = DestRegister;