var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { WebGLRenderingCommon } from './common';
import { WebGLShader } from '../WebGLShader';
import { WebGLFramebuffer } from '../WebGLFramebuffer';
import { WebGLTexture } from '../WebGLTexture';
import { WebGLProgram } from '../WebGLProgram';
import { WebGLUniformLocation } from '../WebGLUniformLocation';
import { WebGLActiveInfo } from '../WebGLActiveInfo';
import { WebGLRenderbuffer } from '../WebGLRenderbuffer';
import { WebGLShaderPrecisionFormat } from '../WebGLShaderPrecisionFormat';
import { WebGLBuffer } from '../WebGLBuffer';
import { ImageSource, profile, Screen } from '@nativescript/core';
import { ANGLE_instanced_arrays, EXT_blend_minmax, EXT_color_buffer_half_float, EXT_disjoint_timer_query, EXT_shader_texture_lod, EXT_sRGB, EXT_texture_filter_anisotropic, OES_element_index_uint, OES_standard_derivatives, OES_texture_float, OES_texture_float_linear, OES_texture_half_float, OES_texture_half_float_linear, OES_vertex_array_object, WEBGL_color_buffer_float, WEBGL_compressed_texture_atc, WEBGL_compressed_texture_etc, WEBGL_compressed_texture_etc1, WEBGL_compressed_texture_pvrtc, WEBGL_compressed_texture_s3tc, WEBGL_depth_texture, WEBGL_draw_buffers, WEBGL_lose_context, } from '../WebGLExtensions';
import { ImageAsset } from '../../ImageAsset';
import { Canvas } from '../../Canvas';
import { ImageBitmap } from '../../ImageBitmap';
import { Helpers } from '../../helpers';
let ctor;
export class WebGLRenderingContextBase extends WebGLRenderingCommon {
    constructor(context, contextOptions) {
        super(context);
        this._flipY = false;
        if (contextOptions) {
            let nativeContext = 0;
            if (global.isAndroid) {
                nativeContext = context.getNativeContext().toString();
            }
            if (global.isIOS) {
                nativeContext = context.nativeContext.toString();
            }
            const ctx = BigInt(nativeContext);
            let direction = 0;
            if (global.isAndroid) {
                if (androidx.core.text.TextUtilsCompat.getLayoutDirectionFromLocale(java.util.Locale.getDefault()) === androidx.core.view.ViewCompat.LAYOUT_DIRECTION_RTL) {
                    direction = 1;
                }
            }
            else {
                // todo
                //direction = 1;
            }
            this._context = global.CanvasModule.createWebGLContext(contextOptions, ctx, Screen.mainScreen.scale, -16777216, Screen.mainScreen.scale * 160, direction);
        }
        else {
            this._context = context;
        }
    }
    get native() {
        return this._context;
    }
    get drawingBufferHeight() {
        if (global.isAndroid) {
            return this._canvas?.drawingBufferHeight ?? 0;
        }
        return this.native.drawingBufferHeight;
    }
    get drawingBufferWidth() {
        if (global.isAndroid) {
            return this._canvas?.drawingBufferWidth ?? 0;
        }
        return this.native.drawingBufferWidth;
    }
    __toDataURL() {
        return this.native.__toDataURL(arguments[0], arguments[1]);
    }
    activeTexture(texture) {
        this.native.activeTexture(texture);
    }
    attachShader(program, shader) {
        const value = program.native;
        const value2 = shader.native;
        this.native.attachShader(value, value2);
    }
    bindAttribLocation(program, index, name) {
        const value = program.native;
        this.native.bindAttribLocation(value, index, name);
    }
    bindBuffer(target, buffer) {
        const value = buffer ? buffer.native : 0;
        this.native.bindBuffer(target, value);
    }
    bindFramebuffer(target, framebuffer) {
        const value = framebuffer ? framebuffer.native : 0;
        this.native.bindFramebuffer(target, value);
    }
    bindRenderbuffer(target, renderbuffer) {
        const value = renderbuffer ? renderbuffer.native : 0;
        this.native.bindRenderbuffer(target, value);
    }
    bindTexture(target, texture) {
        const value = texture ? texture.native : 0;
        this.native.bindTexture(target, value);
    }
    blendColor(red, green, blue, alpha) {
        this.native.blendColor(red, green, blue, alpha);
    }
    blendEquationSeparate(modeRGB, modeAlpha) {
        this.native.blendEquationSeparate(modeRGB, modeAlpha);
    }
    blendEquation(mode) {
        this.native.blendEquation(mode);
    }
    blendFuncSeparate(srcRGB = this.ONE, dstRGB = this.ZERO, srcAlpha = this.ONE, dstAlpha = this.ZERO) {
        this.native.blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
    }
    blendFunc(sfactor = this.ONE, dfactor = this.ZERO) {
        this.native.blendFunc(sfactor, dfactor);
    }
    bufferData(target, srcData, usage) {
        this.native.bufferData(target, srcData, usage);
    }
    bufferSubData(target, offset, srcData) {
        this.native.bufferSubData(target, offset, srcData);
    }
    checkFramebufferStatus(target) {
        return this.native.checkFramebufferStatus(target);
    }
    clearColor(red, green, blue, alpha) {
        this.native.clearColor(red, green, blue, alpha);
    }
    clearDepth(depth) {
        this.native.clearDepth(depth);
    }
    clearStencil(stencil) {
        this.native.clearStencil(stencil);
    }
    clear(mask) {
        this.native.clear(mask);
    }
    colorMask(red, green, blue, alpha) {
        this.native.colorMask(red, green, blue, alpha);
    }
    commit() {
        // NOOP
        this.native.commit();
    }
    compileShader(shader) {
        const value = shader.native;
        this.native.compileShader(value);
    }
    compressedTexImage2D(target, level, internalformat, width, height, border, pixels) {
        this.native.compressedTexImage2D(target, level, internalformat, width, height, border, pixels);
    }
    compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, pixels) {
        this.native.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, pixels);
    }
    copyTexImage2D(target, level, internalformat, x, y, width, height, border) {
        this.native.copyTexImage2D(target, level, internalformat, x, y, width, height, border);
    }
    copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height) {
        this.native.copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
    }
    createBuffer() {
        const id = this.native.createBuffer();
        return new WebGLBuffer(id);
    }
    createFramebuffer() {
        return new WebGLFramebuffer(this.native.createFramebuffer());
    }
    createProgram() {
        return new WebGLProgram(this.native.createProgram());
    }
    createRenderbuffer() {
        return new WebGLRenderbuffer(this.native.createRenderbuffer());
    }
    createShader(type) {
        return new WebGLShader(this.native.createShader(type));
    }
    createTexture() {
        return new WebGLTexture(this.native.createTexture());
    }
    cullFace(mode) {
        this.native.cullFace(mode);
    }
    deleteBuffer(buffer) {
        const value = buffer.native;
        this.native.deleteBuffer(value);
    }
    deleteFramebuffer(frameBuffer) {
        const value = frameBuffer.native;
        this.native.deleteFramebuffer(value);
    }
    deleteProgram(program) {
        const value = program.native;
        this.native.deleteProgram(value);
    }
    deleteRenderbuffer(renderBuffer) {
        const value = renderBuffer.native;
        this.native.deleteRenderbuffer(value);
    }
    deleteShader(shader) {
        this.native.deleteShader(shader.native);
    }
    deleteTexture(texture) {
        const value = texture.native;
        this.native.deleteTexture(value);
    }
    depthFunc(func) {
        this.native.depthFunc(func);
    }
    depthMask(flag) {
        this.native.depthMask(flag);
    }
    depthRange(zNear, zFar) {
        this.native.depthRange(zNear, zFar);
    }
    detachShader(program, shader) {
        const value = program.native;
        const value2 = shader.native;
        this.native.detachShader(value, value2);
    }
    disableVertexAttribArray(index) {
        this.native.disableVertexAttribArray(index);
    }
    disable(cap) {
        this.native.disable(cap);
    }
    drawArrays(mode, first, count) {
        this.native.drawArrays(mode, first, count);
    }
    drawElements(mode, count, type, offset) {
        this.native.drawElements(mode, count, type, offset);
    }
    enableVertexAttribArray(index) {
        this.native.enableVertexAttribArray(index);
    }
    enable(cap) {
        this.native.enable(cap);
    }
    finish() {
        this.native.finish();
    }
    flush() {
        this.native.flush();
    }
    framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer) {
        const value = renderbuffer.native;
        this.native.framebufferRenderbuffer(target, attachment, renderbuffertarget, value);
    }
    framebufferTexture2D(target, attachment, textarget, texture, level) {
        const value = texture.native;
        this.native.framebufferTexture2D(target, attachment, textarget, value, level);
    }
    frontFace(mode) {
        this.native.frontFace(mode);
    }
    generateMipmap(target) {
        this.native.generateMipmap(target);
    }
    getActiveAttrib(program, index) {
        const value = program.native;
        const attrib = this.native.getActiveAttrib(value, index);
        return new WebGLActiveInfo(attrib);
    }
    getActiveUniform(program, index) {
        const value = program.native;
        const uniform = this.native.getActiveUniform(value, index);
        return new WebGLActiveInfo(uniform);
    }
    getAttachedShaders(program) {
        const value = program.native;
        return this.native.getAttachedShaders(value).map((shader) => new WebGLShader(shader));
    }
    getAttribLocation(program, name) {
        const value = program.native;
        return this.native.getAttribLocation(value, name);
    }
    getBufferParameter(target, pname) {
        return this.native.getBufferParameter(target, pname);
    }
    getContextAttributes() {
        return this.native.getContextAttributes();
    }
    getError() {
        return this.native.getError();
    }
    getExtension(name) {
        if (name === 'EXT_disjoint_timer_query_webgl2') {
            return null;
        }
        const ext = this.native.getExtension(name);
        if (ext) {
            const ext_name = ext.ext_name;
            switch (ext_name) {
                case 'ANGLE_instanced_arrays':
                    return new ANGLE_instanced_arrays(ext);
                case 'EXT_blend_minmax':
                    return new EXT_blend_minmax(ext);
                case 'EXT_color_buffer_half_float':
                    return new EXT_color_buffer_half_float(ext);
                case 'EXT_disjoint_timer_query':
                    return new EXT_disjoint_timer_query(ext);
                case 'EXT_sRGB':
                    return new EXT_sRGB(ext);
                case 'EXT_shader_texture_lod':
                    return new EXT_shader_texture_lod(ext);
                case 'EXT_texture_filter_anisotropic':
                    return new EXT_texture_filter_anisotropic(ext);
                case 'OES_element_index_uint':
                    return new OES_element_index_uint(ext);
                case 'OES_standard_derivatives':
                    return new OES_standard_derivatives(ext);
                case 'OES_texture_float':
                    return new OES_texture_float(ext);
                case 'OES_texture_float_linear':
                    return new OES_texture_float_linear(ext);
                case 'OES_texture_half_float':
                    return new OES_texture_half_float(ext);
                case 'OES_texture_half_float_linear':
                    return new OES_texture_half_float_linear(ext);
                case 'OES_vertex_array_object':
                    return new OES_vertex_array_object(ext);
                case 'WEBGL_color_buffer_float':
                    return new WEBGL_color_buffer_float(ext);
                case 'WEBGL_compressed_texture_atc':
                    return new WEBGL_compressed_texture_atc(ext);
                case 'WEBGL_compressed_texture_etc':
                    return new WEBGL_compressed_texture_etc(ext);
                case 'WEBGL_compressed_texture_etc1':
                    return new WEBGL_compressed_texture_etc1(ext);
                case 'WEBGL_compressed_texture_pvrtc':
                    return new WEBGL_compressed_texture_pvrtc(ext);
                case 'WEBGL_compressed_texture_s3tc':
                    return new WEBGL_compressed_texture_s3tc(ext);
                case 'WEBGL_lose_context':
                    return new WEBGL_lose_context(ext);
                case 'WEBGL_depth_texture':
                    return new WEBGL_depth_texture(ext);
                case 'WEBGL_draw_buffers':
                    return new WEBGL_draw_buffers(ext);
            }
        }
        return null;
    }
    getFramebufferAttachmentParameter(target, attachment, pname) {
        const param = this.native.getFramebufferAttachmentParameter(target, attachment, pname);
        if (typeof param === 'object') {
            if (param.isRenderbuffer) {
                return new WebGLRenderbuffer(param);
            }
            else if (param.isTexture()) {
                return new WebGLTexture(param);
            }
        }
        return param;
    }
    _handleGetParameter(pname, value) {
        switch (pname) {
            case this.COLOR_WRITEMASK:
            case this.COLOR_CLEAR_VALUE:
            case this.BLEND_COLOR:
            case this.ALIASED_LINE_WIDTH_RANGE:
            case this.ALIASED_POINT_SIZE_RANGE:
            case this.DEPTH_RANGE:
                return value;
            case this.ARRAY_BUFFER_BINDING:
            case this.ELEMENT_ARRAY_BUFFER_BINDING:
                if (value) {
                    new WebGLBuffer(value);
                }
                return null;
            case this.CURRENT_PROGRAM:
                if (value) {
                    return new WebGLProgram(value);
                }
                return null;
            case this.COMPRESSED_TEXTURE_FORMATS:
                return value;
            case this.RENDERBUFFER_BINDING:
                if (value) {
                    return new WebGLRenderbuffer(value);
                }
                return null;
            case this.FRAMEBUFFER_BINDING:
                if (value) {
                    return new WebGLFramebuffer(value);
                }
                return null;
            case this.VIEWPORT:
            case this.SCISSOR_BOX:
            case this.MAX_VIEWPORT_DIMS:
                return value;
            case this.TEXTURE_BINDING_CUBE_MAP:
            case this.TEXTURE_BINDING_2D:
                if (value) {
                    return new WebGLTexture(value);
                }
                return null;
            case this.VERSION:
                if (this._type === 'webgl2') {
                    return 'WebGL 2.0 (OpenGL ES 3.0 NativeScript)';
                }
                else {
                    return 'WebGL 1.0 (OpenGL ES 2.0 NativeScript)';
                }
            default:
                return value;
        }
    }
    getParameter(pname) {
        const value = this.native.getParameter(pname);
        return this._handleGetParameter(pname, value);
    }
    getProgramInfoLog(program) {
        const value = program.native;
        return this.native.getProgramInfoLog(value);
    }
    getProgramParameter(program, pname) {
        const value = program.native;
        const result = this.native.getProgramParameter(value, pname);
        return result;
    }
    getRenderbufferParameter(target, pname) {
        return this.native.getRenderbufferParameter(target, pname);
    }
    getShaderInfoLog(shader) {
        const value = shader.native;
        return this.native.getShaderInfoLog(value);
    }
    getShaderParameter(shader, pname) {
        const value = shader.native;
        const result = this.native.getShaderParameter(value, pname);
        return result;
    }
    getShaderPrecisionFormat(shaderType, precisionType) {
        const precision = this.native.getShaderPrecisionFormat(shaderType, precisionType);
        return new WebGLShaderPrecisionFormat(precision);
    }
    getShaderSource(shader) {
        const value = shader ? shader.native : 0;
        return this.native.getShaderSource(value);
    }
    getSupportedExtensions() {
        return this.native.getSupportedExtensions();
    }
    getTexParameter(target, pname) {
        return this.native.getTexParameter(target, pname);
    }
    getUniformLocation(program, name) {
        const value = program.native;
        const id = this.native.getUniformLocation(value, name);
        if (id === -1) {
            return null;
        }
        return new WebGLUniformLocation(id);
    }
    getUniform(program, location) {
        const value = program.native;
        const value2 = location.native;
        const uniform = this.native.getUniform(value, value2);
        if (uniform && uniform.length) {
            return uniform;
        }
        return uniform;
    }
    getVertexAttribOffset(index, pname) {
        return this.native.getVertexAttribOffset(index, pname);
    }
    getVertexAttrib(index, pname) {
        const value = this.native.getVertexAttrib(index, pname);
        if (pname === this.CURRENT_VERTEX_ATTRIB) {
            return value;
        }
        return value;
    }
    hint(target, mode) {
        this.native.hint(target, mode);
    }
    isBuffer(buffer) {
        const value = buffer.native;
        return this.native.isBuffer(value);
    }
    isContextLost() {
        return this.native.isContextLost();
    }
    isEnabled(cap) {
        return this.native.isEnabled(cap);
    }
    isFramebuffer(framebuffer) {
        const value = framebuffer ? framebuffer.native : 0;
        return this.native.isFramebuffer(value);
    }
    isProgram(program) {
        const value = program.native;
        return this.native.isProgram(value);
    }
    isRenderbuffer(renderbuffer) {
        const value = renderbuffer.native;
        return this.native.isRenderbuffer(value);
    }
    isShader(shader) {
        const value = shader.native;
        return this.native.isShader(value);
    }
    isTexture(texture) {
        const value = texture.native;
        return this.native.isTexture(value);
    }
    lineWidth(width) {
        this.native.lineWidth(width);
    }
    linkProgram(program) {
        const value = program ? program.native : 0;
        this.native.linkProgram(value);
    }
    pixelStorei(pname, param) {
        if (pname === this.UNPACK_FLIP_Y_WEBGL || pname === this.UNPACK_PREMULTIPLY_ALPHA_WEBGL) {
            if (pname === this.UNPACK_FLIP_Y_WEBGL) {
                this._flipY = param;
            }
            this.native.pixelStorei(pname, param);
        }
        else if (pname === this.PACK_ALIGNMENT || pname === this.UNPACK_ALIGNMENT || pname === this.UNPACK_COLORSPACE_CONVERSION_WEBGL) {
            if (pname === this.UNPACK_COLORSPACE_CONVERSION_WEBGL) {
                param = 0x9244;
            }
            else if (pname === this.PACK_ALIGNMENT || pname === this.UNPACK_ALIGNMENT) {
                //param = 1;
            }
            this.native.pixelStorei(pname, param);
        }
        else {
            this.native.pixelStorei(pname, param);
        }
    }
    polygonOffset(factor, units) {
        this.native.polygonOffset(factor, units);
    }
    readPixels(x, y, width, height, format, type, pixels) {
        this.native.readPixels(x, y, width, height, format, type, pixels);
    }
    renderbufferStorage(target, internalFormat, width, height) {
        if (internalFormat === this.DEPTH_STENCIL) {
            // DEPTH24_STENCIL8 = 35056
            // DEPTH24_STENCIL8_OES = 0x88F0
            internalFormat = 0x88f0;
        }
        this.native.renderbufferStorage(target, internalFormat, width, height);
    }
    sampleCoverage(value, invert) {
        this.native.sampleCoverage(value, invert);
    }
    scissor(x, y, width, height) {
        this.native.scissor(x, y, width, height);
    }
    shaderSource(shader, source) {
        const value = shader ? shader.native : 0;
        this.native.shaderSource(value, source);
    }
    stencilFuncSeparate(face, func, ref, mask) {
        this.native.stencilFuncSeparate(face, func, ref, mask);
    }
    stencilFunc(func, ref, mask) {
        this.native.stencilFunc(func, ref, mask);
    }
    stencilMaskSeparate(face, mask) {
        this.native.stencilMaskSeparate(face, mask);
    }
    stencilMask(mask) {
        this.native.stencilMask(mask);
    }
    stencilOpSeparate(face, fail, zfail, zpass) {
        this.native.stencilOpSeparate(face, fail, zfail, zpass);
    }
    stencilOp(fail, zfail, zpass) {
        this.native.stencilOp(fail, zfail, zpass);
    }
    texImage2D(target, level, internalformat, width, height, border, format, type, pixels) {
        const length = arguments.length;
        if (length === 9) {
            this.native.texImage2D(target, level, internalformat, width, height, border, format, type ?? internalformat, pixels);
        }
        else if (length === 6) {
            if (border && typeof border.tagName === 'string' && (border.tagName === 'VID' || border.tagName === 'VIDEO') && border._video && typeof border._video.getCurrentFrame === 'function') {
                border._video.getCurrentFrame(this.native, this, target, level, internalformat, width, height);
            }
            else if (border && typeof border.getCurrentFrame === 'function') {
                border.getCurrentFrame(this.native, this, target, level, internalformat, width, height);
            }
            else if (border instanceof ImageAsset) {
                this.native.texImage2D(target, level, internalformat, width, height, border.native);
            }
            else if (border instanceof ImageBitmap) {
                this.native.texImage2D(target, level, internalformat, width, height, border.native);
            }
            else if (border instanceof Canvas) {
                this.native.texImage2D(target, level, internalformat, width, height, border.native);
            }
            else if (global.isAndroid && border instanceof android.graphics.Bitmap) {
                // todo ios
                this.native.texImage2D(target, level, internalformat, width, height, border);
            }
            else if (border instanceof ImageSource) {
                if (global.isAndroid) {
                    this.native.texImage2D(target, level, internalformat, width, height, border.android);
                }
            }
            else if (border && typeof border.tagName === 'string' && (border.tagName === 'IMG' || border.tagName === 'IMAGE')) {
                if (border._asset instanceof ImageAsset) {
                    this.native.texImage2D(target, level, internalformat, width, height, border._asset.native);
                }
                else if (border._imageSource instanceof ImageSource) {
                    this.native.texImage2D(target, level, internalformat, width, height, border._imageSource.android);
                }
                else if (global.isAndroid && border._image instanceof android.graphics.Bitmap) {
                    //todo ios
                    this.native.texImage2D(target, level, internalformat, width, height, border._image);
                }
                else if (typeof border.src === 'string') {
                    if (global.isAndroid) {
                        this.native.texImage2D(target, level, internalformat, width, height, ImageSource.fromFileSync(border.src).android);
                    }
                }
            }
            else if (border && typeof border.tagName === 'string' && border.tagName === 'CANVAS' && border._canvas instanceof Canvas) {
                this.native.texImage2D(target, level, internalformat, width, height, border._canvas.native);
            }
        }
    }
    texParameterf(target, pname, param) {
        this.native.texParameterf(target, pname, param);
    }
    texParameteri(target, pname, param) {
        this.native.texParameteri(target, pname, param);
    }
    texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels) {
        const length = arguments.length;
        if (length === 9) {
            this.native.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
        }
        else if (length === 7) {
            if (global.isAndroid && format instanceof android.graphics.Bitmap) {
                // todo
                this.native.texSubImage2D(target, level, xoffset, yoffset, width, height, format);
            }
            else if (format instanceof ImageSource) {
                if (global.isAndroid) {
                    this.native.texSubImage2D(target, level, xoffset, yoffset, width, height, format.android);
                }
            }
            else if (format instanceof ImageAsset) {
                this.native.texSubImage2D(target, level, xoffset, yoffset, width, height, format.native);
            }
            else if (format instanceof Canvas) {
                this.native.texSubImage2D(target, level, xoffset, yoffset, width, height, format.native);
            }
            else if (format instanceof ImageBitmap) {
                this.native.texSubImage2D(target, level, xoffset, yoffset, width, height, format.native);
            }
            else if (format && typeof format.tagName === 'string' && (format.tagName === 'IMG' || format.tagName === 'IMAGE')) {
                if (format._imageSource instanceof ImageSource) {
                    if (global.isAndroid) {
                        this.native.texSubImage2D(target, level, xoffset, yoffset, width, height, format._imageSource.android);
                    }
                }
                else if (global.isAndroid && format._image instanceof android.graphics.Bitmap) {
                    // todo
                    this.native.texSubImage2D(target, level, xoffset, yoffset, width, height, format._image);
                }
                else if (format._asset instanceof ImageAsset) {
                    this.native.texSubImage2D(target, level, xoffset, yoffset, width, height, format._asset.native);
                }
                else if (typeof format.src === 'string') {
                    const result = ImageSource.fromFileSync(format.src);
                    if (global.isAndroid && result.android) {
                        this.native.texSubImage2D(target, level, xoffset, yoffset, width, height, result.android);
                    }
                    if (global.isIOS && result.ios) {
                        this.native.texSubImage2D(target, level, xoffset, yoffset, width, height, result.ios);
                    }
                }
            }
            else if (format && typeof format.tagName === 'string' && format.tagName === 'CANVAS' && format._canvas instanceof Canvas) {
                this.native.texSubImage2D(target, level, xoffset, yoffset, width, height, format._canvas.native);
            }
        }
    }
    uniform1f(location, v0) {
        const loc = location.native;
        this.native.uniform1f(loc, v0);
    }
    uniform1iv(location, value) {
        const loc = location.native;
        this.native.uniform1iv(loc, value);
    }
    uniform1fv(location, value) {
        const loc = location.native;
        this.native.uniform1fv(loc, value);
    }
    uniform1i(location, v0) {
        const loc = location.native;
        this.native.uniform1i(loc, Number(v0));
    }
    uniform2f(location, v0, v1) {
        const loc = location.native;
        this.native.uniform2f(loc, v0, v1);
    }
    uniform2iv(location, value) {
        const loc = location.native;
        this.native.uniform2iv(loc, value);
    }
    uniform2fv(location, value) {
        const loc = location.native;
        this.native.uniform2fv(loc, value);
    }
    uniform2i(location, v0, v1) {
        const loc = location.native;
        this.native.uniform2i(loc, v0, v1);
    }
    uniform3f(location, v0, v1, v2) {
        const loc = location.native;
        this.native.uniform3f(loc, v0, v1, v2);
    }
    uniform3iv(location, value) {
        const loc = location.native;
        this.native.uniform3iv(loc, value);
    }
    uniform3fv(location, value) {
        const loc = location.native;
        this.native.uniform3fv(loc, value);
    }
    uniform3i(location, v0, v1, v2) {
        const loc = location.native;
        this.native.uniform3i(loc, v0, v1, v2);
    }
    uniform4f(location, v0, v1, v2, v3) {
        const loc = location.native;
        this.native.uniform4f(loc, v0, v1, v2, v3);
    }
    uniform4iv(location, value) {
        const loc = location.native;
        this.native.uniform4iv(loc, value);
    }
    uniform4fv(location, value) {
        const loc = location.native;
        this.native.uniform4fv(loc, value);
    }
    uniform4i(location, v0, v1, v2, v3) {
        const loc = location.native;
        this.native.uniform4i(loc, v0, v1, v2, v3);
    }
    uniformMatrix2fv(location, transpose, value) {
        const loc = location.native;
        this.native.uniformMatrix2fv(loc, transpose, value);
    }
    uniformMatrix3fv(location, transpose, value) {
        const loc = location.native;
        this.native.uniformMatrix3fv(loc, transpose, value);
    }
    uniformMatrix4fv(location, transpose, value) {
        const loc = location.native;
        this.native.uniformMatrix4fv(loc, transpose, value);
    }
    useProgram(program) {
        const value = program ? program.native : 0;
        this.native.useProgram(value);
    }
    validateProgram(program) {
        const value = program.native;
        this.native.validateProgram(value);
    }
    vertexAttrib1f(index, v0) {
        this.native.vertexAttrib1f(index, v0);
    }
    vertexAttrib1fv(index, value) {
        this.native.vertexAttrib1fv(index, value);
    }
    vertexAttrib2f(index, v0, v1) {
        this.native.vertexAttrib2f(index, v0, v1);
    }
    vertexAttrib2fv(index, value) {
        this.native.vertexAttrib2fv(index, value);
    }
    vertexAttrib3f(index, v0, v1, v2) {
        this.native.vertexAttrib3f(index, v0, v1, v2);
    }
    vertexAttrib3fv(index, value) {
        this.native.vertexAttrib3fv(index, value);
    }
    vertexAttrib4f(index, v0, v1, v2, v3) {
        this.native.vertexAttrib4f(index, v0, v1, v2, v3);
    }
    vertexAttrib4fv(index, value) {
        this.native.vertexAttrib4fv(index, value);
    }
    vertexAttribPointer(index, size, type, normalized, stride, offset) {
        this.native.vertexAttribPointer(index, size, type, !!normalized, stride, offset);
    }
    viewport(x, y, width, height) {
        this.native.viewport(x, y, width, height);
    }
    _glCheckError(message) {
        if (!WebGLRenderingContext.isDebug) {
            return;
        }
        if (WebGLRenderingContext.filter === 'both' || WebGLRenderingContext.filter === 'error') {
            console.log(message, this.getError());
        }
    }
    _checkArgs(message, args) {
        if (!WebGLRenderingContext.isDebug) {
            return;
        }
        if (WebGLRenderingContext.filter === 'both' || WebGLRenderingContext.filter === 'args') {
            console.log('/**** ', message, ' ****/');
            console.dir(args);
            console.log('/**** ', message, ' ****/');
        }
    }
}
WebGLRenderingContextBase.isDebug = false;
WebGLRenderingContextBase.filter = 'both';
(() => {
    Helpers.initialize();
})();
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "activeTexture", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLProgram, WebGLShader]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "attachShader", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLProgram, Number, String]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "bindAttribLocation", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, WebGLBuffer]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "bindBuffer", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, WebGLFramebuffer]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "bindFramebuffer", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, WebGLRenderbuffer]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "bindRenderbuffer", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, WebGLTexture]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "bindTexture", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "blendColor", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "blendEquationSeparate", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "blendEquation", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "blendFuncSeparate", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "blendFunc", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "bufferData", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "bufferSubData", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", Number)
], WebGLRenderingContextBase.prototype, "checkFramebufferStatus", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "clearColor", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "clearDepth", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "clearStencil", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "clear", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Boolean, Boolean, Boolean, Boolean]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "colorMask", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "commit", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLShader]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "compileShader", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Number, Number, Number, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "compressedTexImage2D", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Number, Number, Number, Number, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "compressedTexSubImage2D", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Number, Number, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "copyTexImage2D", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Number, Number, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "copyTexSubImage2D", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", WebGLBuffer)
], WebGLRenderingContextBase.prototype, "createBuffer", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", WebGLFramebuffer)
], WebGLRenderingContextBase.prototype, "createFramebuffer", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", WebGLProgram)
], WebGLRenderingContextBase.prototype, "createProgram", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", WebGLRenderbuffer)
], WebGLRenderingContextBase.prototype, "createRenderbuffer", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", WebGLShader)
], WebGLRenderingContextBase.prototype, "createShader", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", WebGLTexture)
], WebGLRenderingContextBase.prototype, "createTexture", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "cullFace", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLBuffer]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "deleteBuffer", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLFramebuffer]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "deleteFramebuffer", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLProgram]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "deleteProgram", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLRenderbuffer]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "deleteRenderbuffer", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLRenderbuffer]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "deleteShader", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLTexture]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "deleteTexture", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "depthFunc", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Boolean]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "depthMask", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "depthRange", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLProgram, WebGLShader]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "detachShader", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "disableVertexAttribArray", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "disable", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "drawArrays", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "drawElements", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "enableVertexAttribArray", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "enable", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "finish", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "flush", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, WebGLRenderbuffer]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "framebufferRenderbuffer", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, WebGLTexture, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "framebufferTexture2D", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "frontFace", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "generateMipmap", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLProgram, Number]),
    __metadata("design:returntype", WebGLActiveInfo)
], WebGLRenderingContextBase.prototype, "getActiveAttrib", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLProgram, Number]),
    __metadata("design:returntype", WebGLActiveInfo)
], WebGLRenderingContextBase.prototype, "getActiveUniform", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLProgram]),
    __metadata("design:returntype", Array)
], WebGLRenderingContextBase.prototype, "getAttachedShaders", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLProgram, String]),
    __metadata("design:returntype", Number)
], WebGLRenderingContextBase.prototype, "getAttribLocation", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", Number)
], WebGLRenderingContextBase.prototype, "getBufferParameter", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Object)
], WebGLRenderingContextBase.prototype, "getContextAttributes", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Number)
], WebGLRenderingContextBase.prototype, "getError", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "getExtension", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number]),
    __metadata("design:returntype", Object)
], WebGLRenderingContextBase.prototype, "getFramebufferAttachmentParameter", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", Object)
], WebGLRenderingContextBase.prototype, "getParameter", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLProgram]),
    __metadata("design:returntype", String)
], WebGLRenderingContextBase.prototype, "getProgramInfoLog", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLProgram, Number]),
    __metadata("design:returntype", Object)
], WebGLRenderingContextBase.prototype, "getProgramParameter", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", Number)
], WebGLRenderingContextBase.prototype, "getRenderbufferParameter", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLShader]),
    __metadata("design:returntype", String)
], WebGLRenderingContextBase.prototype, "getShaderInfoLog", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLShader, Number]),
    __metadata("design:returntype", Object)
], WebGLRenderingContextBase.prototype, "getShaderParameter", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", WebGLShaderPrecisionFormat)
], WebGLRenderingContextBase.prototype, "getShaderPrecisionFormat", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLShader]),
    __metadata("design:returntype", String)
], WebGLRenderingContextBase.prototype, "getShaderSource", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Array)
], WebGLRenderingContextBase.prototype, "getSupportedExtensions", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", Number)
], WebGLRenderingContextBase.prototype, "getTexParameter", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLProgram, String]),
    __metadata("design:returntype", WebGLUniformLocation)
], WebGLRenderingContextBase.prototype, "getUniformLocation", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLProgram, WebGLUniformLocation]),
    __metadata("design:returntype", Object)
], WebGLRenderingContextBase.prototype, "getUniform", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", Number)
], WebGLRenderingContextBase.prototype, "getVertexAttribOffset", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", Object)
], WebGLRenderingContextBase.prototype, "getVertexAttrib", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "hint", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLBuffer]),
    __metadata("design:returntype", Boolean)
], WebGLRenderingContextBase.prototype, "isBuffer", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Boolean)
], WebGLRenderingContextBase.prototype, "isContextLost", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", Boolean)
], WebGLRenderingContextBase.prototype, "isEnabled", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLFramebuffer]),
    __metadata("design:returntype", Boolean)
], WebGLRenderingContextBase.prototype, "isFramebuffer", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLProgram]),
    __metadata("design:returntype", Boolean)
], WebGLRenderingContextBase.prototype, "isProgram", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLRenderbuffer]),
    __metadata("design:returntype", Boolean)
], WebGLRenderingContextBase.prototype, "isRenderbuffer", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLShader]),
    __metadata("design:returntype", Boolean)
], WebGLRenderingContextBase.prototype, "isShader", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLTexture]),
    __metadata("design:returntype", Boolean)
], WebGLRenderingContextBase.prototype, "isTexture", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "lineWidth", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLProgram]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "linkProgram", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "pixelStorei", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "polygonOffset", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Number, Number, Number, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "readPixels", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "renderbufferStorage", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Boolean]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "sampleCoverage", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "scissor", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLShader, String]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "shaderSource", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "stencilFuncSeparate", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "stencilFunc", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "stencilMaskSeparate", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "stencilMask", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "stencilOpSeparate", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "stencilOp", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object, Object, Object, Object, Object, Object, Object, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "texImage2D", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "texParameterf", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "texParameteri", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object, Object, Object, Object, Object, Object, Object, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "texSubImage2D", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniform1f", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniform1iv", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniform1fv", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniform1i", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniform2f", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniform2iv", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniform2fv", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniform2i", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniform3f", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniform3iv", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniform3fv", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniform3i", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Number, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniform4f", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniform4iv", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniform4fv", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Number, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniform4i", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Boolean, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniformMatrix2fv", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Boolean, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniformMatrix3fv", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLUniformLocation, Boolean, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "uniformMatrix4fv", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLProgram]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "useProgram", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [WebGLProgram]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "validateProgram", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "vertexAttrib1f", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "vertexAttrib1fv", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "vertexAttrib2f", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "vertexAttrib2fv", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "vertexAttrib3f", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "vertexAttrib3fv", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "vertexAttrib4f", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Object]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "vertexAttrib4fv", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Boolean, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "vertexAttribPointer", null);
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number, Number, Number]),
    __metadata("design:returntype", void 0)
], WebGLRenderingContextBase.prototype, "viewport", null);
export class WebGLRenderingContext extends WebGLRenderingContextBase {
}
//# sourceMappingURL=index.js.map