@gjsify/webgl 0.4.28 → 0.4.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- import"../_virtual/_rolldown/runtime.js";import{WebGLUniformLocation as e}from"../webgl-uniform-location.js";import{checkObject as t,checkUniform as n,isValidString as r,listToArray as i,uniformTypeSize as a}from"../utils.js";import{WebGLProgram as o}from"../webgl-program.js";import{WebGLShader as s}from"../webgl-shader.js";import{WebGLActiveInfo as c}from"../webgl-active-info.js";import{WebGLShaderPrecisionFormat as l}from"../webgl-shader-precision-format.js";import u from"glsl-tokenizer/string";const d={createShader(e=0){if(e!==this.FRAGMENT_SHADER&&e!==this.VERTEX_SHADER)return this.setError(this.INVALID_ENUM),null;let t=this._gl.createShader(e);if(t<0)return null;let n=new s(t,this,e);return this._shaders[t]=n,n},deleteShader(e){this._deleteLinkable(`deleteShader`,e,s)},compileShader(e){if(!t(e))throw TypeError(`compileShader(WebGLShader)`);if(this._checkWrapper(e,s)&&this._checkShaderSource(e)){let t=this.getError();this._gl.compileShader(e._|0),e._needsRecompile=!1;let n=this.getError();e._compileStatus=!!this._gl.getShaderParameter(e._|0,this.COMPILE_STATUS),e._compileInfo=this._gl.getShaderInfoLog(e._|0)||`null`,this.getError(),this.setError(t||n)}},shaderSource(e,n){if(!t(e))throw TypeError(`shaderSource(WebGLShader, String)`);if(!e||!n&&typeof n!=`string`){this.setError(this.INVALID_VALUE);return}r(n)?this._checkWrapper(e,s)&&(n=this._wrapShader(e._type,n),this._gl.shaderSource(e._|0,n),e._source=n,e._needsRecompile=!0):this.setError(this.INVALID_VALUE)},getShaderInfoLog(e){if(!t(e))throw TypeError(`getShaderInfoLog(WebGLShader)`);return this._checkWrapper(e,s)?e._compileInfo:null},getShaderParameter(e,n=0){if(!t(e))throw TypeError(`getShaderParameter(WebGLShader, GLenum)`);if(this._checkWrapper(e,s)){switch(n){case this.DELETE_STATUS:return e._pendingDelete;case this.COMPILE_STATUS:return e._compileStatus;case this.SHADER_TYPE:return e._type}this.setError(this.INVALID_ENUM)}return null},getShaderPrecisionFormat(e=0,t=0){if(!(e===this.FRAGMENT_SHADER||e===this.VERTEX_SHADER)||!(t===this.LOW_FLOAT||t===this.MEDIUM_FLOAT||t===this.HIGH_FLOAT||t===this.LOW_INT||t===this.MEDIUM_INT||t===this.HIGH_INT))return this.setError(this.INVALID_ENUM),null;let n=this._gl.getShaderPrecisionFormat(e,t);return n?new l(n):null},getShaderSource(e){if(!t(e))throw TypeError(`Input to getShaderSource must be an object`);return this._checkWrapper(e,s)?e._source:null},attachShader(e,n){if(!t(e)||!t(n))throw TypeError(`attachShader(WebGLProgram, WebGLShader)`);if(!e||!n){this.setError(this.INVALID_VALUE);return}else if(e instanceof o&&n instanceof s&&this._checkOwns(e)&&this._checkOwns(n)&&!e._linked(n)){this._saveError(),this._gl.attachShader(e._|0,n._|0);let t=this.getError();this._restoreError(t),t===this.NO_ERROR&&e._link(n);return}this.setError(this.INVALID_OPERATION)},detachShader(e,n){if(!t(e)||!t(n))throw TypeError(`detachShader(WebGLProgram, WebGLShader)`);this._checkWrapper(e,o)&&this._checkWrapper(n,s)&&(e._linked(n)?(this._gl.detachShader(e._,n._),e._unlink(n)):this.setError(this.INVALID_OPERATION))},bindAttribLocation(e,n,i){if(!t(e)||typeof i!=`string`)throw TypeError(`bindAttribLocation(WebGLProgram, GLint, String)`);i+=``,!r(i)||i.length>256?this.setError(this.INVALID_VALUE):/^_?webgl_a/.test(i)?this.setError(this.INVALID_OPERATION):this._checkWrapper(e,o)&&this._gl.bindAttribLocation(e._|0,n|0,i)},createProgram(){let e=this._gl.createProgram();if(e<=0)return null;let t=new o(e,this);return this._programs[e]=t,t},deleteProgram(e){this._deleteLinkable(`deleteProgram`,e,o)},useProgram(e){if(!t(e))throw TypeError(`useProgram(WebGLProgram)`);if(e)this._checkWrapper(e,o)&&(this._activeProgram!==e&&(this._switchActiveProgram(this._activeProgram),this._activeProgram=e,e._refCount+=1),this._gl.useProgram(e._|0));else{this._switchActiveProgram(this._activeProgram),this._activeProgram=null,this._gl.useProgram(0);return}},linkProgram(e){if(!t(e))throw TypeError(`linkProgram(WebGLProgram)`);if(this._checkWrapper(e,o)){e._linkCount+=1,e._attributes=[];let t=this.getError();for(let t of e._references)t instanceof s&&t._needsRecompile&&(this._gl.compileShader(t._|0),t._needsRecompile=!1);this._gl.linkProgram(e._|0);let n=this.getError();n===this.NO_ERROR&&(e._linkStatus=this._fixupLink(e)),this.getError(),this.setError(t||n)}},validateProgram(e){if(this._checkWrapper(e,o)){this._gl.validateProgram(e._|0);let t=this.getError();t===this.NO_ERROR&&(e._linkInfoLog=this._gl.getProgramInfoLog(e._|0)),this.getError(),this.setError(t)}},getActiveAttrib(e,n){if(!t(e))throw TypeError(`getActiveAttrib(WebGLProgram)`);if(!e)throw TypeError(`getActiveAttrib(WebGLProgram, GLuint)`);if(this._checkWrapper(e,o)){if(n>=(e._linkStatus?e._attributes.length:this._gl.getProgramParameter(e._|0,this.ACTIVE_ATTRIBUTES)))return this._gl.getError(),this.setError(this.INVALID_VALUE),null;let t=this._gl.getActiveAttrib(e._|0,n|0);if(t)return new c(t)}return null},getActiveUniform(e,n){if(!t(e))throw TypeError(`getActiveUniform(WebGLProgram, GLint)`);if(!e)throw TypeError(`getActiveUniform(WebGLProgram, GLuint)`);if(this._checkWrapper(e,o)){if(n>=(e._linkStatus?e._uniforms.length:this._gl.getProgramParameter(e._|0,this.ACTIVE_UNIFORMS)))return this.setError(this.INVALID_VALUE),null;let t=this._gl.getActiveUniform(e._|0,n|0);if(t)return new c(t)}return null},getAttachedShaders(e){if(!t(e)||typeof e==`object`&&e&&!(e instanceof o))throw TypeError(`getAttachedShaders(WebGLProgram)`);if(!e)this.setError(this.INVALID_VALUE);else if(this._checkWrapper(e,o))return e._references.filter(e=>e instanceof s);return null},getAttribLocation(e,n){if(!t(e))throw TypeError(`getAttribLocation(WebGLProgram, String)`);if(n+=``,!r(n)||n.length>256)this.setError(this.INVALID_VALUE);else if(this._checkWrapper(e,o))return this._gl.getAttribLocation(e._|0,n+``);return-1},getUniform(e,r){if(!t(e)||!t(r))throw TypeError(`getUniform(WebGLProgram, WebGLUniformLocation)`);if(!e)return this.setError(this.INVALID_VALUE),null;if(!r)return null;if(this._checkWrapper(e,o)){if(!n(e,r))return this.setError(this.INVALID_OPERATION),null;let t=this._gl.getUniform(e._|0,r._|0);if(!t)return null;switch(r._activeInfo.type){case this.FLOAT:return t[0];case this.FLOAT_VEC2:return new Float32Array(t.slice(0,2));case this.FLOAT_VEC3:return new Float32Array(t.slice(0,3));case this.FLOAT_VEC4:return new Float32Array(t.slice(0,4));case this.INT:return t[0]|0;case this.INT_VEC2:return new Int32Array(t.slice(0,2));case this.INT_VEC3:return new Int32Array(t.slice(0,3));case this.INT_VEC4:return new Int32Array(t.slice(0,4));case this.BOOL:return!!t[0];case this.BOOL_VEC2:return[!!t[0],!!t[1]];case this.BOOL_VEC3:return[!!t[0],!!t[1],!!t[2]];case this.BOOL_VEC4:return[!!t[0],!!t[1],!!t[2],!!t[3]];case this.FLOAT_MAT2:return new Float32Array(t.slice(0,4));case this.FLOAT_MAT3:return new Float32Array(t.slice(0,9));case this.FLOAT_MAT4:return new Float32Array(t.slice(0,16));case this.SAMPLER_2D:case this.SAMPLER_CUBE:return t[0]|0;default:return null}}return null},getUniformLocation(n,i){if(!t(n))throw TypeError(`getUniformLocation(WebGLProgram, String)`);if(i+=``,!r(i))return this.setError(this.INVALID_VALUE),null;if(this._checkWrapper(n,o)){let t=this._gl.getUniformLocation(n._|0,i);if(t!==null&&t>=0){let r=i;/\[\d+\]$/.test(i)&&(r=i.replace(/\[\d+\]$/,`[0]`));let a=r+`[0]`,o=null;for(let e=0;e<n._uniforms.length;++e){let t=n._uniforms[e];if(t.name===r||t.name===a){o={size:t.size,type:t.type,name:t.name};break}}o||={name:r,type:0,size:1};let s=new e(t,n,o),c=i.match(/\[(\d+)\]$/),l=c?+c[1]:-1;if(/\[0\]$/.test(o.name)&&(l===-1||l===0)){let e=o.name.replace(/\[0\]$/,``),t=[];this._saveError();for(let r=0;this.getError()===this.NO_ERROR;++r){let i=this._gl.getUniformLocation(n._|0,e+`[`+r+`]`);if(this.getError()!==this.NO_ERROR||i==null||i<0)break;t.push(i)}this._restoreError(this.NO_ERROR),s._array=t}else if(l>0&&l>=o.size)return null;return s}}return null},getProgramInfoLog(e){if(!t(e))throw TypeError(`getProgramInfoLog(WebGLProgram)`);return this._checkWrapper(e,o)?e._linkInfoLog:null},getProgramParameter(e,n=0){if(!t(e))throw TypeError(`getProgramParameter(WebGLProgram, GLenum)`);if(this._checkWrapper(e,o)){switch(n){case this.DELETE_STATUS:return e._pendingDelete;case this.LINK_STATUS:return e._linkStatus;case this.VALIDATE_STATUS:return!!this._gl.getProgramParameter(e._,n);case this.ATTACHED_SHADERS:return this._gl.getProgramParameter(e._,n);case this.ACTIVE_ATTRIBUTES:return e._linkStatus?e._attributes.length:this._gl.getProgramParameter(e._,n);case this.ACTIVE_UNIFORMS:return e._linkStatus?e._uniforms.length:this._gl.getProgramParameter(e._,n)}this.setError(this.INVALID_ENUM)}return null},uniform1f(e,t){this._checkUniformValid(e,t,`uniform1f`,1,`f`)&&this._gl.uniform1f(e?._||0,t)},uniform1i(e,t){this._gl.uniform1i(e?._||0,t)},uniform2f(e,t,n){this._checkUniformValid(e,t,`uniform2f`,2,`f`)&&this._gl.uniform2f(e?._||0,t,n)},uniform2i(e,t,n){this._checkUniformValid(e,t,`uniform2i`,2,`i`)&&this._gl.uniform2i(e?._||0,t,n)},uniform3f(e,t,n,r){this._checkUniformValid(e,t,`uniform3f`,3,`f`)&&this._gl.uniform3f(e?._||0,t,n,r)},uniform3i(e,t,n,r){this._checkUniformValid(e,t,`uniform3i`,3,`i`)&&this._gl.uniform3i(e?._||0,t,n,r)},uniform4f(e,t,n,r,i){if(!this._checkUniformValid(e,t,`uniform4f`,4,`f`)){console.error(`uniform4f is not valid!`);return}this._gl.uniform4f(e?._||0,t,n,r,i)},uniform4i(e,t,n,r,i){this._checkUniformValid(e,t,`uniform4i`,4,`i`)&&this._gl.uniform4i(e?._||0,t,n,r,i)},uniform1fv(e,t){if(!(!e||!this._checkUniformValueValid(e,t,`uniform1fv`,1,`f`))){if(e?._array){let n=e._array;for(let e=0;e<n.length&&e<t.length;++e){let r=n[e];r!=null&&this._gl.uniform1f(r,t[e])}return}this._gl.uniform1f(e?._|0,t[0])}},uniform1iv(e,t){if(this._checkUniformValueValid(e,t,`uniform1iv`,1,`i`)){if(e?._array){let n=e._array;for(let e=0;e<n.length&&e<t.length;++e){let r=n[e];r!=null&&this._gl.uniform1i(r,t[e])}return}this.uniform1i(e,t[0])}},uniform2fv(e,t){if(this._checkUniformValueValid(e,t,`uniform2fv`,2,`f`)){if(e?._array){let n=e._array;for(let e=0;e<n.length&&2*e<t.length;++e){let r=n[e];r!=null&&this._gl.uniform2f(r,t[2*e],t[2*e+1])}return}this._gl.uniform2f(e?._||0,t[0],t[1])}},uniform2iv(e,t){if(this._checkUniformValueValid(e,t,`uniform2iv`,2,`i`)){if(e?._array){let n=e._array;for(let e=0;e<n.length&&2*e<t.length;++e){let r=n[e];r!=null&&this._gl.uniform2i(r,t[2*e],t[2*e+1])}return}this.uniform2i(e,t[0],t[1])}},uniform3fv(e,t){if(this._checkUniformValueValid(e,t,`uniform3fv`,3,`f`)){if(e?._array){let n=e._array;for(let e=0;e<n.length&&3*e<t.length;++e){let r=n[e];r!=null&&this._gl.uniform3f(r,t[3*e],t[3*e+1],t[3*e+2])}return}this._gl.uniform3f(e?._||0,t[0],t[1],t[2])}},uniform3iv(e,t){if(this._checkUniformValueValid(e,t,`uniform3iv`,3,`i`)){if(e?._array){let n=e._array;for(let e=0;e<n.length&&3*e<t.length;++e){let r=n[e];r!=null&&this._gl.uniform3i(r,t[3*e],t[3*e+1],t[3*e+2])}return}this.uniform3i(e,t[0],t[1],t[2])}},uniform4fv(e,t){if(this._checkUniformValueValid(e,t,`uniform4fv`,4,`f`)){if(e?._array){let n=e._array;for(let e=0;e<n.length&&4*e<t.length;++e){let r=n[e];r!=null&&this._gl.uniform4f(r,t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}return}this._gl.uniform4f(e?._||0,t[0],t[1],t[2],t[3])}},uniform4iv(e,t){if(this._checkUniformValueValid(e,t,`uniform4iv`,4,`i`)){if(e?._array){let n=e._array;for(let e=0;e<n.length&&4*e<t.length;++e){let r=n[e];r!=null&&this._gl.uniform4i(r,t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}return}this.uniform4i(e,t[0],t[1],t[2],t[3])}},uniformMatrix2fv(e,t,n){if(!this._checkUniformMatrix(e,t,n,`uniformMatrix2fv`,2))return;let r=new Float32Array(n);this._gl.uniformMatrix2fv(e?._||0,!!t,i(r))},uniformMatrix3fv(e,t,n){if(!this._checkUniformMatrix(e,t,n,`uniformMatrix3fv`,3))return;let r=new Float32Array(n);this._gl.uniformMatrix3fv(e?._||0,!!t,i(r))},uniformMatrix4fv(e,t,n){if(!this._checkUniformMatrix(e,t,n,`uniformMatrix4fv`,4))return;let r=new Float32Array(n);this._gl.uniformMatrix4fv(e?._||0,!!t,i(r))},_checkLocation(t){return t instanceof e?t._program._ctx!==this||t._linkCount!==t._program._linkCount?(this.setError(this.INVALID_OPERATION),!1):!0:(this.setError(this.INVALID_VALUE),!1)},_checkLocationActive(e){return e&&this._checkLocation(e)?e._program===this._activeProgram?!0:(this.setError(this.INVALID_OPERATION),!1):!1},_checkUniformValid(e,n,r,i,o){if(!t(e))throw TypeError(`${r}(WebGLUniformLocation, ...)`);if(!e)return!1;if(this._checkLocationActive(e)){let t=e._activeInfo.type;if(t===this.SAMPLER_2D||t===this.SAMPLER_CUBE){if(i!==1)return this.setError(this.INVALID_VALUE),!1;if(o!==`i`)return this.setError(this.INVALID_OPERATION),!1;if(n<0||n>=this._textureUnits.length)return this.setError(this.INVALID_VALUE),!1}return a(this,t)>i?(this.setError(this.INVALID_OPERATION),!1):!0}return!1},_checkUniformValueValid(e,n,r,i,o){if(!t(e)||!t(n))throw TypeError(`${r}v(WebGLUniformLocation, Array)`);if(!e||!this._checkLocationActive(e))return!1;if(typeof n!=`object`||!n||typeof n.length!=`number`)throw TypeError(`Second argument to ${r} must be array`);return a(this,e._activeInfo.type)>i?(this.setError(this.INVALID_OPERATION),!1):n.length>=i&&n.length%i===0?e._array||n.length===i?!0:(this.setError(this.INVALID_OPERATION),!1):(this.setError(this.INVALID_VALUE),!1)},_checkUniformMatrix(e,n,r,i,a){if(!t(e)||typeof r!=`object`)throw TypeError(i+`(WebGLUniformLocation, Boolean, Array)`);return n||typeof r!=`object`||!r||!r.length||r.length%a*a!==0?(this.setError(this.INVALID_VALUE),!1):!e||!this._checkLocationActive(e)?!1:r.length===a*a||e._array?!0:(this.setError(this.INVALID_VALUE),!1)},_checkShaderSource(e){let t=e._source,n=u(t),r=!1,i=[];for(let e=0;e<n.length;++e){let t=n[e];if(t)switch(t.type){case`ident`:this._validGLSLIdentifier(t.data)||(r=!0,i.push(t.line+`:`+t.column+` invalid identifier - `+t.data));break;case`preprocessor`:{let e=t.data.match(/^\s*#\s*(.*)$/);if(!e||e?.length<2)break;let n=u(e[1]);for(let e=0;e<n.length;++e){let a=n[e];(a.type===`ident`||a.type===void 0)&&(this._validGLSLIdentifier(a.data)||(r=!0,i.push(t.line+`:`+a.column+` invalid identifier - `+a.data)))}break}case`keyword`:switch(t.data){case`do`:r=!0,i.push(t.line+`:`+t.column+` do not supported`);break}break;case`builtin`:switch(t.data){case`dFdx`:case`dFdy`:case`fwidth`:!this._extensions.oes_standard_derivatives&&this._getGlslVersion(!0)===`100`&&(r=!0,i.push(t.line+`:`+t.column+` `+t.data+` not supported`));break}}}return r&&(e._compileInfo=i.join(`
1
+ import"../_virtual/_rolldown/runtime.js";import{WebGLUniformLocation as e}from"../webgl-uniform-location.js";import{checkObject as t,checkUniform as n,isValidString as r,listToArray as i,uniformTypeSize as a}from"../utils.js";import{WebGLProgram as o}from"../webgl-program.js";import{WebGLShader as s}from"../webgl-shader.js";import{WebGLActiveInfo as c}from"../webgl-active-info.js";import{WebGLShaderPrecisionFormat as l}from"../webgl-shader-precision-format.js";import u from"glsl-tokenizer/string";const d={createShader(e=0){if(e!==this.FRAGMENT_SHADER&&e!==this.VERTEX_SHADER)return this.setError(this.INVALID_ENUM),null;let t=this._gl.createShader(e);if(t<0)return null;let n=new s(t,this,e);return this._shaders[t]=n,n},deleteShader(e){this._deleteLinkable(`deleteShader`,e,s)},compileShader(e){if(!t(e))throw TypeError(`compileShader(WebGLShader)`);if(this._checkWrapper(e,s)&&this._checkShaderSource(e)){let t=this.getError();this._gl.compileShader(e._|0),e._needsRecompile=!1;let n=this.getError();e._compileStatus=!!this._gl.getShaderParameter(e._|0,this.COMPILE_STATUS),e._compileInfo=this._gl.getShaderInfoLog(e._|0)||`null`,this.getError(),this.setError(t||n)}},shaderSource(e,n){if(!t(e))throw TypeError(`shaderSource(WebGLShader, String)`);if(!e||!n&&typeof n!=`string`){this.setError(this.INVALID_VALUE);return}r(n)?this._checkWrapper(e,s)&&(n=this._wrapShader(e._type,n),this._gl.shaderSource(e._|0,n),e._source=n,e._needsRecompile=!0):this.setError(this.INVALID_VALUE)},getShaderInfoLog(e){if(!t(e))throw TypeError(`getShaderInfoLog(WebGLShader)`);return this._checkWrapper(e,s)?e._compileInfo:null},getShaderParameter(e,n=0){if(!t(e))throw TypeError(`getShaderParameter(WebGLShader, GLenum)`);if(this._checkWrapper(e,s)){switch(n){case this.DELETE_STATUS:return e._pendingDelete;case this.COMPILE_STATUS:return e._compileStatus;case this.SHADER_TYPE:return e._type}this.setError(this.INVALID_ENUM)}return null},getShaderPrecisionFormat(e=0,t=0){if(!(e===this.FRAGMENT_SHADER||e===this.VERTEX_SHADER)||!(t===this.LOW_FLOAT||t===this.MEDIUM_FLOAT||t===this.HIGH_FLOAT||t===this.LOW_INT||t===this.MEDIUM_INT||t===this.HIGH_INT))return this.setError(this.INVALID_ENUM),null;let n=this._gl.getShaderPrecisionFormat(e,t);return n?new l(n):null},getShaderSource(e){if(!t(e))throw TypeError(`Input to getShaderSource must be an object`);return this._checkWrapper(e,s)?e._source:null},attachShader(e,n){if(!t(e)||!t(n))throw TypeError(`attachShader(WebGLProgram, WebGLShader)`);if(!e||!n){this.setError(this.INVALID_VALUE);return}else if(e instanceof o&&n instanceof s&&this._checkOwns(e)&&this._checkOwns(n)&&!e._linked(n)){this._saveError(),this._gl.attachShader(e._|0,n._|0);let t=this.getError();this._restoreError(t),t===this.NO_ERROR&&e._link(n);return}this.setError(this.INVALID_OPERATION)},detachShader(e,n){if(!t(e)||!t(n))throw TypeError(`detachShader(WebGLProgram, WebGLShader)`);this._checkWrapper(e,o)&&this._checkWrapper(n,s)&&(e._linked(n)?(this._gl.detachShader(e._,n._),e._unlink(n)):this.setError(this.INVALID_OPERATION))},bindAttribLocation(e,n,i){if(!t(e)||typeof i!=`string`)throw TypeError(`bindAttribLocation(WebGLProgram, GLint, String)`);i+=``,!r(i)||i.length>256?this.setError(this.INVALID_VALUE):/^_?webgl_a/.test(i)?this.setError(this.INVALID_OPERATION):this._checkWrapper(e,o)&&this._gl.bindAttribLocation(e._|0,n|0,i)},createProgram(){let e=this._gl.createProgram();if(e<=0)return null;let t=new o(e,this);return this._programs[e]=t,t},deleteProgram(e){this._deleteLinkable(`deleteProgram`,e,o)},useProgram(e){if(!t(e))throw TypeError(`useProgram(WebGLProgram)`);if(e)this._checkWrapper(e,o)&&(this._activeProgram!==e&&(this._switchActiveProgram(this._activeProgram),this._activeProgram=e,e._refCount+=1),this._gl.useProgram(e._|0));else{this._switchActiveProgram(this._activeProgram),this._activeProgram=null,this._gl.useProgram(0);return}},linkProgram(e){if(!t(e))throw TypeError(`linkProgram(WebGLProgram)`);if(this._checkWrapper(e,o)){e._linkCount+=1,e._attributes=[];let t=this.getError();for(let t of e._references)t instanceof s&&t._needsRecompile&&(this._gl.compileShader(t._|0),t._needsRecompile=!1);this._gl.linkProgram(e._|0);let n=this.getError();n===this.NO_ERROR&&(e._linkStatus=this._fixupLink(e)),this.getError(),this.setError(t||n)}},validateProgram(e){if(this._checkWrapper(e,o)){this._gl.validateProgram(e._|0);let t=this.getError();t===this.NO_ERROR&&(e._linkInfoLog=this._gl.getProgramInfoLog(e._|0)),this.getError(),this.setError(t)}},getActiveAttrib(e,n){if(!t(e))throw TypeError(`getActiveAttrib(WebGLProgram)`);if(!e)throw TypeError(`getActiveAttrib(WebGLProgram, GLuint)`);if(this._checkWrapper(e,o)){if(n>=(e._linkStatus?e._attributes.length:this._gl.getProgramParameter(e._|0,this.ACTIVE_ATTRIBUTES)))return this._gl.getError(),this.setError(this.INVALID_VALUE),null;let t=this._gl.getActiveAttrib(e._|0,n|0);if(t)return new c(t)}return null},getActiveUniform(e,n){if(!t(e))throw TypeError(`getActiveUniform(WebGLProgram, GLint)`);if(!e)throw TypeError(`getActiveUniform(WebGLProgram, GLuint)`);if(this._checkWrapper(e,o)){if(n>=(e._linkStatus?e._uniforms.length:this._gl.getProgramParameter(e._|0,this.ACTIVE_UNIFORMS)))return this.setError(this.INVALID_VALUE),null;let t=this._gl.getActiveUniform(e._|0,n|0);if(t)return new c(t)}return null},getAttachedShaders(e){if(!t(e)||typeof e==`object`&&e&&!(e instanceof o))throw TypeError(`getAttachedShaders(WebGLProgram)`);if(!e)this.setError(this.INVALID_VALUE);else if(this._checkWrapper(e,o))return e._references.filter(e=>e instanceof s);return null},getAttribLocation(e,n){if(!t(e))throw TypeError(`getAttribLocation(WebGLProgram, String)`);if(n+=``,!r(n)||n.length>256)this.setError(this.INVALID_VALUE);else if(this._checkWrapper(e,o))return this._gl.getAttribLocation(e._|0,n+``);return-1},getUniform(e,r){if(!t(e)||!t(r))throw TypeError(`getUniform(WebGLProgram, WebGLUniformLocation)`);if(!e)return this.setError(this.INVALID_VALUE),null;if(!r)return null;if(this._checkWrapper(e,o)){if(!n(e,r))return this.setError(this.INVALID_OPERATION),null;let t=this._gl.getUniform(e._|0,r._|0);if(!t)return null;switch(r._activeInfo.type){case this.FLOAT:return t[0];case this.FLOAT_VEC2:return new Float32Array(t.slice(0,2));case this.FLOAT_VEC3:return new Float32Array(t.slice(0,3));case this.FLOAT_VEC4:return new Float32Array(t.slice(0,4));case this.INT:return t[0]|0;case this.INT_VEC2:return new Int32Array(t.slice(0,2));case this.INT_VEC3:return new Int32Array(t.slice(0,3));case this.INT_VEC4:return new Int32Array(t.slice(0,4));case this.BOOL:return!!t[0];case this.BOOL_VEC2:return[!!t[0],!!t[1]];case this.BOOL_VEC3:return[!!t[0],!!t[1],!!t[2]];case this.BOOL_VEC4:return[!!t[0],!!t[1],!!t[2],!!t[3]];case this.FLOAT_MAT2:return new Float32Array(t.slice(0,4));case this.FLOAT_MAT3:return new Float32Array(t.slice(0,9));case this.FLOAT_MAT4:return new Float32Array(t.slice(0,16));case this.SAMPLER_2D:case this.SAMPLER_CUBE:return t[0]|0;default:return null}}return null},getUniformLocation(n,i){if(!t(n))throw TypeError(`getUniformLocation(WebGLProgram, String)`);if(i+=``,!r(i))return this.setError(this.INVALID_VALUE),null;if(this._checkWrapper(n,o)){let t=this._gl.getUniformLocation(n._|0,i);if(t!==null&&t>=0){let r=i;/\[\d+\]$/.test(i)&&(r=i.replace(/\[\d+\]$/,`[0]`));let a=r+`[0]`,o=null;for(let e=0;e<n._uniforms.length;++e){let t=n._uniforms[e];if(t.name===r||t.name===a){o={size:t.size,type:t.type,name:t.name};break}}o||={name:r,type:0,size:1};let s=new e(t,n,o),c=i.match(/\[(\d+)\]$/),l=c?+c[1]:-1;if(o.name.endsWith(`[0]`)&&(l===-1||l===0)){let e=o.name.replace(/\[0\]$/,``),t=[];this._saveError();for(let r=0;this.getError()===this.NO_ERROR;++r){let i=this._gl.getUniformLocation(n._|0,e+`[`+r+`]`);if(this.getError()!==this.NO_ERROR||i==null||i<0)break;t.push(i)}this._restoreError(this.NO_ERROR),s._array=t}else if(l>0&&l>=o.size)return null;return s}}return null},getProgramInfoLog(e){if(!t(e))throw TypeError(`getProgramInfoLog(WebGLProgram)`);return this._checkWrapper(e,o)?e._linkInfoLog:null},getProgramParameter(e,n=0){if(!t(e))throw TypeError(`getProgramParameter(WebGLProgram, GLenum)`);if(this._checkWrapper(e,o)){switch(n){case this.DELETE_STATUS:return e._pendingDelete;case this.LINK_STATUS:return e._linkStatus;case this.VALIDATE_STATUS:return!!this._gl.getProgramParameter(e._,n);case this.ATTACHED_SHADERS:return this._gl.getProgramParameter(e._,n);case this.ACTIVE_ATTRIBUTES:return e._linkStatus?e._attributes.length:this._gl.getProgramParameter(e._,n);case this.ACTIVE_UNIFORMS:return e._linkStatus?e._uniforms.length:this._gl.getProgramParameter(e._,n)}this.setError(this.INVALID_ENUM)}return null},uniform1f(e,t){this._checkUniformValid(e,t,`uniform1f`,1,`f`)&&this._gl.uniform1f(e?._||0,t)},uniform1i(e,t){this._gl.uniform1i(e?._||0,t)},uniform2f(e,t,n){this._checkUniformValid(e,t,`uniform2f`,2,`f`)&&this._gl.uniform2f(e?._||0,t,n)},uniform2i(e,t,n){this._checkUniformValid(e,t,`uniform2i`,2,`i`)&&this._gl.uniform2i(e?._||0,t,n)},uniform3f(e,t,n,r){this._checkUniformValid(e,t,`uniform3f`,3,`f`)&&this._gl.uniform3f(e?._||0,t,n,r)},uniform3i(e,t,n,r){this._checkUniformValid(e,t,`uniform3i`,3,`i`)&&this._gl.uniform3i(e?._||0,t,n,r)},uniform4f(e,t,n,r,i){if(!this._checkUniformValid(e,t,`uniform4f`,4,`f`)){console.error(`uniform4f is not valid!`);return}this._gl.uniform4f(e?._||0,t,n,r,i)},uniform4i(e,t,n,r,i){this._checkUniformValid(e,t,`uniform4i`,4,`i`)&&this._gl.uniform4i(e?._||0,t,n,r,i)},uniform1fv(e,t){if(!(!e||!this._checkUniformValueValid(e,t,`uniform1fv`,1,`f`))){if(e?._array){let n=e._array;for(let e=0;e<n.length&&e<t.length;++e){let r=n[e];r!=null&&this._gl.uniform1f(r,t[e])}return}this._gl.uniform1f(e?._|0,t[0])}},uniform1iv(e,t){if(this._checkUniformValueValid(e,t,`uniform1iv`,1,`i`)){if(e?._array){let n=e._array;for(let e=0;e<n.length&&e<t.length;++e){let r=n[e];r!=null&&this._gl.uniform1i(r,t[e])}return}this.uniform1i(e,t[0])}},uniform2fv(e,t){if(this._checkUniformValueValid(e,t,`uniform2fv`,2,`f`)){if(e?._array){let n=e._array;for(let e=0;e<n.length&&2*e<t.length;++e){let r=n[e];r!=null&&this._gl.uniform2f(r,t[2*e],t[2*e+1])}return}this._gl.uniform2f(e?._||0,t[0],t[1])}},uniform2iv(e,t){if(this._checkUniformValueValid(e,t,`uniform2iv`,2,`i`)){if(e?._array){let n=e._array;for(let e=0;e<n.length&&2*e<t.length;++e){let r=n[e];r!=null&&this._gl.uniform2i(r,t[2*e],t[2*e+1])}return}this.uniform2i(e,t[0],t[1])}},uniform3fv(e,t){if(this._checkUniformValueValid(e,t,`uniform3fv`,3,`f`)){if(e?._array){let n=e._array;for(let e=0;e<n.length&&3*e<t.length;++e){let r=n[e];r!=null&&this._gl.uniform3f(r,t[3*e],t[3*e+1],t[3*e+2])}return}this._gl.uniform3f(e?._||0,t[0],t[1],t[2])}},uniform3iv(e,t){if(this._checkUniformValueValid(e,t,`uniform3iv`,3,`i`)){if(e?._array){let n=e._array;for(let e=0;e<n.length&&3*e<t.length;++e){let r=n[e];r!=null&&this._gl.uniform3i(r,t[3*e],t[3*e+1],t[3*e+2])}return}this.uniform3i(e,t[0],t[1],t[2])}},uniform4fv(e,t){if(this._checkUniformValueValid(e,t,`uniform4fv`,4,`f`)){if(e?._array){let n=e._array;for(let e=0;e<n.length&&4*e<t.length;++e){let r=n[e];r!=null&&this._gl.uniform4f(r,t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}return}this._gl.uniform4f(e?._||0,t[0],t[1],t[2],t[3])}},uniform4iv(e,t){if(this._checkUniformValueValid(e,t,`uniform4iv`,4,`i`)){if(e?._array){let n=e._array;for(let e=0;e<n.length&&4*e<t.length;++e){let r=n[e];r!=null&&this._gl.uniform4i(r,t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}return}this.uniform4i(e,t[0],t[1],t[2],t[3])}},uniformMatrix2fv(e,t,n){if(!this._checkUniformMatrix(e,t,n,`uniformMatrix2fv`,2))return;let r=new Float32Array(n);this._gl.uniformMatrix2fv(e?._||0,!!t,i(r))},uniformMatrix3fv(e,t,n){if(!this._checkUniformMatrix(e,t,n,`uniformMatrix3fv`,3))return;let r=new Float32Array(n);this._gl.uniformMatrix3fv(e?._||0,!!t,i(r))},uniformMatrix4fv(e,t,n){if(!this._checkUniformMatrix(e,t,n,`uniformMatrix4fv`,4))return;let r=new Float32Array(n);this._gl.uniformMatrix4fv(e?._||0,!!t,i(r))},_checkLocation(t){return t instanceof e?t._program._ctx!==this||t._linkCount!==t._program._linkCount?(this.setError(this.INVALID_OPERATION),!1):!0:(this.setError(this.INVALID_VALUE),!1)},_checkLocationActive(e){return e&&this._checkLocation(e)?e._program===this._activeProgram?!0:(this.setError(this.INVALID_OPERATION),!1):!1},_checkUniformValid(e,n,r,i,o){if(!t(e))throw TypeError(`${r}(WebGLUniformLocation, ...)`);if(!e)return!1;if(this._checkLocationActive(e)){let t=e._activeInfo.type;if(t===this.SAMPLER_2D||t===this.SAMPLER_CUBE){if(i!==1)return this.setError(this.INVALID_VALUE),!1;if(o!==`i`)return this.setError(this.INVALID_OPERATION),!1;if(n<0||n>=this._textureUnits.length)return this.setError(this.INVALID_VALUE),!1}return a(this,t)>i?(this.setError(this.INVALID_OPERATION),!1):!0}return!1},_checkUniformValueValid(e,n,r,i,o){if(!t(e)||!t(n))throw TypeError(`${r}v(WebGLUniformLocation, Array)`);if(!e||!this._checkLocationActive(e))return!1;if(typeof n!=`object`||!n||typeof n.length!=`number`)throw TypeError(`Second argument to ${r} must be array`);return a(this,e._activeInfo.type)>i?(this.setError(this.INVALID_OPERATION),!1):n.length>=i&&n.length%i===0?e._array||n.length===i?!0:(this.setError(this.INVALID_OPERATION),!1):(this.setError(this.INVALID_VALUE),!1)},_checkUniformMatrix(e,n,r,i,a){if(!t(e)||typeof r!=`object`)throw TypeError(i+`(WebGLUniformLocation, Boolean, Array)`);return n||typeof r!=`object`||!r||!r.length||r.length%a*a!==0?(this.setError(this.INVALID_VALUE),!1):!e||!this._checkLocationActive(e)?!1:r.length===a*a||e._array?!0:(this.setError(this.INVALID_VALUE),!1)},_checkShaderSource(e){let t=e._source,n=u(t),r=!1,i=[];for(let e=0;e<n.length;++e){let t=n[e];if(t)switch(t.type){case`ident`:this._validGLSLIdentifier(t.data)||(r=!0,i.push(t.line+`:`+t.column+` invalid identifier - `+t.data));break;case`preprocessor`:{let e=t.data.match(/^\s*#\s*(.*)$/);if(!e||e?.length<2)break;let n=u(e[1]);for(let e=0;e<n.length;++e){let a=n[e];(a.type===`ident`||a.type===void 0)&&(this._validGLSLIdentifier(a.data)||(r=!0,i.push(t.line+`:`+a.column+` invalid identifier - `+a.data)))}break}case`keyword`:switch(t.data){case`do`:r=!0,i.push(t.line+`:`+t.column+` do not supported`);break}break;case`builtin`:switch(t.data){case`dFdx`:case`dFdy`:case`fwidth`:!this._extensions.oes_standard_derivatives&&this._getGlslVersion(!0)===`100`&&(r=!0,i.push(t.line+`:`+t.column+` `+t.data+` not supported`));break}}}return r&&(e._compileInfo=i.join(`
2
2
  `)),!r},_wrapShader(e,t){let n=t.startsWith(`#version`)||t.includes(`
3
3
  #version`),r=``;if(!this._extensions.oes_standard_derivatives&&/#ifdef\s+GL_OES_standard_derivatives/.test(t)&&(r+=`#undef GL_OES_standard_derivatives
4
4
  `),!this._extensions.webgl_draw_buffers&&!n&&(r+=`#define gl_MaxDrawBuffers 1
5
5
  `),n){if(r){let e=t.indexOf(`
6
6
  `);t=e===-1?t+`
7
7
  `+r:t.slice(0,e+1)+r+t.slice(e+1)}}else if(this.canvas){let e=this.canvas.getGlArea().get_use_es(),n=/\b(attribute|varying)\b/.test(t)?e?`100`:`120`:this._getGlslVersion(e);n?t=`#version `+n+`
8
- `+r+t:r&&(t=r+t)}else r&&(t=r+t);return t},_switchActiveProgram(e){e&&(--e._refCount,e._checkDelete())},_fixupLink(e){if(!this._gl.getProgramParameter(e._,this.LINK_STATUS))return e._linkInfoLog=this._gl.getProgramInfoLog(e._),!1;let t=this.getProgramParameter(e,this.ACTIVE_ATTRIBUTES),n=Array(t);e._attributes.length=t;for(let r=0;r<t;++r)n[r]=this.getActiveAttrib(e,r)?.name,e._attributes[r]=this.getAttribLocation(e,n[r])|0;for(let t=0;t<n.length;++t)if(n[t].length>256)return e._linkInfoLog=`attribute `+n[t]+` is too long`,!1;for(let r=0;r<t;++r)e._attributes[r]<0||this._gl.bindAttribLocation(e._|0,e._attributes[r],n[r]);if(this._gl.linkProgram(e._|0),!this._gl.getProgramParameter(e._|0,this.LINK_STATUS))return e._linkInfoLog=this._gl.getProgramInfoLog(e._),!1;let r=this.getProgramParameter(e,this.ACTIVE_UNIFORMS);e._uniforms.length=r;for(let t=0;t<r;++t){let n=this.getActiveUniform(e,t);n&&(e._uniforms[t]=n)}for(let t=0;t<e._uniforms.length;++t)if(e._uniforms[t].name.length>256)return e._linkInfoLog=`uniform `+e._uniforms[t].name+` is too long`,!1;return e._linkInfoLog=``,!0},_deleteLinkable(e,n,r){if(!t(n))throw TypeError(e+`(`+r.name+`)`);if(n instanceof r&&this._checkOwns(n)){n._pendingDelete=!0,n._checkDelete();return}this.setError(this.INVALID_OPERATION)}};function installShaderProgramMethods(e){Object.assign(e,d)}export{installShaderProgramMethods};
8
+ `+r+t:r&&(t=r+t)}else r&&(t=r+t);return t},_switchActiveProgram(e){e&&(--e._refCount,e._checkDelete())},_fixupLink(e){if(!this._gl.getProgramParameter(e._,this.LINK_STATUS))return e._linkInfoLog=this._gl.getProgramInfoLog(e._),!1;let t=this.getProgramParameter(e,this.ACTIVE_ATTRIBUTES),n=Array.from({length:t});e._attributes.length=t;for(let r=0;r<t;++r)n[r]=this.getActiveAttrib(e,r)?.name,e._attributes[r]=this.getAttribLocation(e,n[r])|0;for(let t=0;t<n.length;++t)if(n[t].length>256)return e._linkInfoLog=`attribute `+n[t]+` is too long`,!1;for(let r=0;r<t;++r)e._attributes[r]<0||this._gl.bindAttribLocation(e._|0,e._attributes[r],n[r]);if(this._gl.linkProgram(e._|0),!this._gl.getProgramParameter(e._|0,this.LINK_STATUS))return e._linkInfoLog=this._gl.getProgramInfoLog(e._),!1;let r=this.getProgramParameter(e,this.ACTIVE_UNIFORMS);e._uniforms.length=r;for(let t=0;t<r;++t){let n=this.getActiveUniform(e,t);n&&(e._uniforms[t]=n)}for(let t=0;t<e._uniforms.length;++t)if(e._uniforms[t].name.length>256)return e._linkInfoLog=`uniform `+e._uniforms[t].name+` is too long`,!1;return e._linkInfoLog=``,!0},_deleteLinkable(e,n,r){if(!t(n))throw TypeError(e+`(`+r.name+`)`);if(n instanceof r&&this._checkOwns(n)){n._pendingDelete=!0,n._checkDelete();return}this.setError(this.INVALID_OPERATION)}};function installShaderProgramMethods(e){Object.assign(e,d)}export{installShaderProgramMethods};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{Uint8ArrayToVariant as e,arrayToUint8Array as t,checkFormat as n,checkObject as r,convertPixels as i,extractImageData as a,formatSize as o,premultiplyAlpha as s,validCubeTarget as c}from"../utils.js";import{WebGLTexture as l}from"../webgl-texture.js";import*as u from"bit-twiddle";import d from"gi://GdkPixbuf?version=2.0";const f={activeTexture(e=0){let t=e-this.TEXTURE0;if(t>=0&&t<this._textureUnits.length){this._activeTextureUnit=t,this._gl.activeTexture(e);return}this.setError(this.INVALID_ENUM)},bindTexture(e=0,t){if(!r(t))throw TypeError(`bindTexture(GLenum, WebGLTexture)`);if(!this._validTextureTarget(e)){this.setError(this.INVALID_ENUM);return}let n=0;if(!t)t=null;else if(t instanceof l&&t._pendingDelete)return;else if(this._checkWrapper(t,l)){if(t._binding&&t._binding!==e){this.setError(this.INVALID_OPERATION);return}t._binding=e,t._complete&&(n=t._|0)}else return;this._saveError(),this._gl.bindTexture(e,n);let i=this.getError();if(this._restoreError(i),i!==this.NO_ERROR)return;let a=this._getActiveTextureUnit(),o=this._getActiveTexture(e);o!==t&&(o&&(--o._refCount,o._checkDelete()),t&&(t._refCount+=1)),e===this.TEXTURE_2D?a._bind2D=t:e===this.TEXTURE_CUBE_MAP&&(a._bindCube=t)},createTexture(){let e=this._gl.createTexture();if(e<=0)return null;let t=new l(e,this);return this._textures[e]=t,t},deleteTexture(e){if(!r(e))throw TypeError(`deleteTexture(WebGLTexture)`);if(e instanceof l){if(!this._checkOwns(e)){this.setError(this.INVALID_OPERATION);return}}else return;let t=this._activeTextureUnit;for(let t=0;t<this._textureUnits.length;++t){let n=this._textureUnits[t];n._bind2D===e?(this.activeTexture(this.TEXTURE0+t),this.bindTexture(this.TEXTURE_2D,null)):n._bindCube===e&&(this.activeTexture(this.TEXTURE0+t),this.bindTexture(this.TEXTURE_CUBE_MAP,null))}this.activeTexture(this.TEXTURE0+t),this._detachTextureFromAllFramebuffers(e),e._pendingDelete=!0,e._checkDelete()},_detachTextureFromAllFramebuffers(e){let t=this._activeFramebuffer,n=this._getAttachments(),r=!1;for(let i in this._framebuffers){let a=this._framebuffers[i];if(!(!a||!a._linked(e))){a!==t&&(this._gl.bindFramebuffer(this.FRAMEBUFFER,a._|0),r=!0);for(let t=0;t<n.length;++t){let r=n[t];a._attachments[r]===e&&(this._gl.framebufferTexture2D(this.FRAMEBUFFER,r,a._attachmentFace[r]||this.TEXTURE_2D,0,a._attachmentLevel[r]||0),a._setAttachment(null,r))}}}r&&this._gl.bindFramebuffer(this.FRAMEBUFFER,t?t._|0:this._gtkFboId)},pixelStorei(e=0,t=0){if(typeof t==`boolean`&&(t=t===!1?0:1),e===this.UNPACK_ALIGNMENT)if(t===1||t===2||t===4||t===8)this._unpackAlignment=t;else{this.setError(this.INVALID_VALUE);return}else if(e===this.PACK_ALIGNMENT)if(t===1||t===2||t===4||t===8)this._packAlignment=t;else{this.setError(this.INVALID_VALUE);return}else if(e===this.UNPACK_COLORSPACE_CONVERSION_WEBGL){if(!(t===this.NONE||t===this.BROWSER_DEFAULT_WEBGL)){this.setError(this.INVALID_VALUE);return}}else if(e===this.UNPACK_FLIP_Y_WEBGL){this._unpackFlipY=!!t;return}else if(e===this.UNPACK_PREMULTIPLY_ALPHA_WEBGL){this._unpackPremultAlpha=!!t;return}this._gl.pixelStorei(e,t)},texImage2D(t=0,r=0,o=0,l=0,u=0,f=0,p=0,m=0,h){let g=0,_=0,v=0,y,b,x=0;if(arguments.length===6)if(m=u,v=l,f instanceof d.Pixbuf)b=f,g=b.get_width(),_=b.get_height(),h=b.get_pixels();else{y=f;let e=a(y);if(e==null)throw TypeError(`texImage2D(GLenum, GLint, GLenum, GLint, GLenum, GLenum, ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement)`);g=e.width,_=e.height,h=e.data}else arguments.length===9&&(g=l,_=u,x=f,v=p,m=m,h=h);if(typeof h!=`object`&&h!==void 0)throw TypeError(`texImage2D(GLenum, GLint, GLenum, GLint, GLint, GLint, GLenum, GLenum, Uint8Array)`);if(!n(this,v)||!n(this,o)){this.setError(this.INVALID_ENUM);return}if(m===this.FLOAT&&!this._extensions.oes_texture_float){this.setError(this.INVALID_ENUM);return}let S=this._getTexImage(t);if(!S||v!==o){this.setError(this.INVALID_OPERATION);return}let C=this._computePixelSize(m,v);if(C===0||!this._checkDimensions(t,g,_,r))return;let w=i(h),T=this._computeRowStride(g,C),E=T*_;if(w&&w.length<E){this.setError(this.INVALID_OPERATION);return}if(x!==0||c(this,t)&&g!==_){this.setError(this.INVALID_VALUE);return}if(this._unpackPremultAlpha&&w&&v===this.RGBA&&(w=s(w)),this._unpackFlipY&&w&&g>0&&_>0){let e=new Uint8Array(w.length);for(let t=0;t<_;t++){let n=t*T,r=(_-1-t)*T;e.set(w.subarray(n,n+T),r)}w=e}this._saveError(),this._gl.texImage2D(t,r,o,g,_,x,v,m,e(w));let D=this.getError();if(this._restoreError(D),D!==this.NO_ERROR)return;S._levelWidth[r]=g,S._levelHeight[r]=_,S._format=v,S._type=m;let O=this._activeFramebuffer;if(O){let e=!1,t=this._getAttachments();for(let n=0;n<t.length;++n)if(O._attachments[t[n]]===S){e=!0;break}e&&this._activeFramebuffer&&this._updateFramebufferAttachments(this._activeFramebuffer)}},texSubImage2D(t=0,n=0,r=0,o=0,c=0,l=0,u=0,f=0,p){let m=0,h=0,g=0,_,v;if(arguments.length===7)if(f=l,g=c,u instanceof d.Pixbuf)v=u,m=v.get_width(),h=v.get_height(),p=v.get_pixels();else{_=u;let e=a(_);if(e==null)throw TypeError(`texSubImage2D(GLenum, GLint, GLint, GLint, GLenum, GLenum, ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement)`);m=e.width,h=e.height,p=e.data}else m=c,h=l,g=u;if(typeof p!=`object`)throw TypeError(`texSubImage2D(GLenum, GLint, GLint, GLint, GLint, GLint, GLenum, GLenum, Uint8Array)`);if(!this._getTexImage(t)){this.setError(this.INVALID_OPERATION);return}if(f===this.FLOAT&&!this._extensions.oes_texture_float){this.setError(this.INVALID_ENUM);return}let y=this._computePixelSize(f,g);if(y===0||!this._checkDimensions(t,m,h,n))return;if(r<0||o<0){this.setError(this.INVALID_VALUE);return}let b=i(p),x=this._computeRowStride(m,y),S=x*h;if(!b||b.length<S){this.setError(this.INVALID_OPERATION);return}if(this._unpackPremultAlpha&&b&&g===this.RGBA&&(b=s(b)),this._unpackFlipY&&b&&m>0&&h>0){let e=new Uint8Array(b.length);for(let t=0;t<h;t++){let n=t*x,r=(h-1-t)*x;e.set(b.subarray(n,n+x),r)}b=e}this._gl.texSubImage2D(t,n,r,o,m,h,g,f,e(b))},copyTexImage2D(e=0,t=0,n=0,r=0,i=0,a=0,o=0,s=0){let c=this._getTexImage(e);if(!c){this.setError(this.INVALID_OPERATION);return}if(n!==this.RGBA&&n!==this.RGB&&n!==this.ALPHA&&n!==this.LUMINANCE&&n!==this.LUMINANCE_ALPHA){this.setError(this.INVALID_ENUM);return}if(t<0||a<0||o<0||s!==0){this.setError(this.INVALID_VALUE);return}if(t>0&&!(u.isPow2(a)&&u.isPow2(o))){this.setError(this.INVALID_VALUE);return}this._saveError(),this._gl.copyTexImage2D(e,t,n,r,i,a,o,s);let l=this.getError();this._restoreError(l),l===this.NO_ERROR&&(c._levelWidth[t]=a,c._levelHeight[t]=o,c._format=this.RGBA,c._type=this.UNSIGNED_BYTE)},copyTexSubImage2D(e=0,t=0,n=0,r=0,i=0,a=0,o=0,s=0){if(!this._getTexImage(e)){this.setError(this.INVALID_OPERATION);return}if(o<0||s<0||n<0||r<0||t<0){this.setError(this.INVALID_VALUE);return}this._gl.copyTexSubImage2D(e,t,n,r,i,a,o,s)},compressedTexImage2D(n,r,i,a,o,s,c){this._gl.compressedTexImage2D(n,r,i,a,o,s,e(t(c)))},compressedTexSubImage2D(n,r,i,a,o,s,c,l){this._gl.compressedTexSubImage2D(n,r,i,a,o,s,c,e(t(l)))},texParameterf(e=0,t=0,n){if(n=+n,this._checkTextureTarget(e)){switch(this._verifyTextureCompleteness(e,t,n),t){case this.TEXTURE_MIN_FILTER:case this.TEXTURE_MAG_FILTER:case this.TEXTURE_WRAP_S:case this.TEXTURE_WRAP_T:this._gl.texParameterf(e,t,n);return}if(this._extensions.ext_texture_filter_anisotropic&&t===this._extensions.ext_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT){this._gl.texParameterf(e,t,n);return}this.setError(this.INVALID_ENUM)}},texParameteri(e=0,t=0,n=0){if(this._checkTextureTarget(e)){switch(this._verifyTextureCompleteness(e,t,n),t){case this.TEXTURE_MIN_FILTER:case this.TEXTURE_MAG_FILTER:case this.TEXTURE_WRAP_S:case this.TEXTURE_WRAP_T:this._gl.texParameteri(e,t,n);return}if(this._extensions.ext_texture_filter_anisotropic&&t===this._extensions.ext_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT){this._gl.texParameteri(e,t,n);return}this.setError(this.INVALID_ENUM)}},getTexParameter(e=0,t=0){if(!this._checkTextureTarget(e))return null;let n=this._getActiveTextureUnit();if(e===this.TEXTURE_2D&&!n._bind2D||e===this.TEXTURE_CUBE_MAP&&!n._bindCube)return this.setError(this.INVALID_OPERATION),null;switch(t){case this.TEXTURE_MAG_FILTER:case this.TEXTURE_MIN_FILTER:case this.TEXTURE_WRAP_S:case this.TEXTURE_WRAP_T:return this._getTexParameterDirect(e,t)}return this._extensions.ext_texture_filter_anisotropic&&t===this._extensions.ext_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT?this._getTexParameterDirect(e,t):(this.setError(this.INVALID_ENUM),null)},_getTexParameterDirect(e=0,t=0){return this._gl.getTexParameterx(e,t)?.unpack()},_getActiveTextureUnit(){return this._textureUnits[this._activeTextureUnit]},_getActiveTexture(e){let t=this._getActiveTextureUnit();return e===this.TEXTURE_2D?t._bind2D:e===this.TEXTURE_CUBE_MAP?t._bindCube:null},_getTexImage(e){let t=this._getActiveTextureUnit();return e===this.TEXTURE_2D?t._bind2D:c(this,e)?t._bindCube:(this.setError(this.INVALID_ENUM),null)},_checkTextureTarget(e){let t=this._getActiveTextureUnit(),n=null;if(e===this.TEXTURE_2D)n=t._bind2D;else if(e===this.TEXTURE_CUBE_MAP)n=t._bindCube;else return this.setError(this.INVALID_ENUM),!1;return n?!0:(this.setError(this.INVALID_OPERATION),!1)},_validTextureTarget(e){return e===this.TEXTURE_2D||e===this.TEXTURE_CUBE_MAP},_validCubeTarget(e){return e===this.TEXTURE_CUBE_MAP_POSITIVE_X||e===this.TEXTURE_CUBE_MAP_NEGATIVE_X||e===this.TEXTURE_CUBE_MAP_POSITIVE_Y||e===this.TEXTURE_CUBE_MAP_NEGATIVE_Y||e===this.TEXTURE_CUBE_MAP_POSITIVE_Z||e===this.TEXTURE_CUBE_MAP_NEGATIVE_Z},_verifyTextureCompleteness(e,t,n){let r=this._getActiveTextureUnit(),i=null;if(e===this.TEXTURE_2D?i=r._bind2D:this._validCubeTarget(e)&&(i=r._bindCube),this._extensions.oes_texture_float&&!this._extensions.oes_texture_float_linear&&i&&i._type===this.FLOAT&&(t===this.TEXTURE_MAG_FILTER||t===this.TEXTURE_MIN_FILTER)&&(n===this.LINEAR||n===this.LINEAR_MIPMAP_NEAREST||n===this.NEAREST_MIPMAP_LINEAR||n===this.LINEAR_MIPMAP_LINEAR)){i._complete=!1,this.bindTexture(e,i);return}i&&i._complete===!1&&(i._complete=!0,this.bindTexture(e,i))},_computePixelSize(e,t){let n=o(this,t);if(n===0)return this.setError(this.INVALID_ENUM),0;switch(e){case this.UNSIGNED_BYTE:return n;case this.UNSIGNED_SHORT_5_6_5:if(t!==this.RGB){this.setError(this.INVALID_OPERATION);break}return 2;case this.UNSIGNED_SHORT_4_4_4_4:case this.UNSIGNED_SHORT_5_5_5_1:if(t!==this.RGBA){this.setError(this.INVALID_OPERATION);break}return 2;case this.FLOAT:return 1}return this.setError(this.INVALID_ENUM),0},_computeRowStride(e,t){let n=e*t;return n%this._unpackAlignment&&(n+=this._unpackAlignment-n%this._unpackAlignment),n},_checkDimensions(e,t,n,r){if(r<0||t<0||n<0)return this.setError(this.INVALID_VALUE),!1;if(e===this.TEXTURE_2D){if(t>this._maxTextureSize||n>this._maxTextureSize||r>this._maxTextureLevel)return this.setError(this.INVALID_VALUE),!1}else if(this._validCubeTarget(e)){if(t>this._maxCubeMapSize||n>this._maxCubeMapSize||r>this._maxCubeMapLevel)return this.setError(this.INVALID_VALUE),!1}else return this.setError(this.INVALID_ENUM),!1;return!0}};function installTextureManagementMethods(e){Object.assign(e,f)}export{installTextureManagementMethods};
1
+ import"../_virtual/_rolldown/runtime.js";import{Uint8ArrayToVariant as e,arrayToUint8Array as t,checkFormat as n,checkObject as r,convertPixels as i,extractImageData as a,formatSize as o,premultiplyAlpha as s,validCubeTarget as c}from"../utils.js";import{WebGLTexture as l}from"../webgl-texture.js";import*as u from"bit-twiddle";import d from"gi://GdkPixbuf?version=2.0";const f={activeTexture(e=0){let t=e-this.TEXTURE0;if(t>=0&&t<this._textureUnits.length){this._activeTextureUnit=t,this._gl.activeTexture(e);return}this.setError(this.INVALID_ENUM)},bindTexture(e=0,t){if(!r(t))throw TypeError(`bindTexture(GLenum, WebGLTexture)`);if(!this._validTextureTarget(e)){this.setError(this.INVALID_ENUM);return}let n=0;if(!t)t=null;else if(t instanceof l&&t._pendingDelete)return;else if(this._checkWrapper(t,l)){if(t._binding&&t._binding!==e){this.setError(this.INVALID_OPERATION);return}t._binding=e,t._complete&&(n=t._|0)}else return;this._saveError(),this._gl.bindTexture(e,n);let i=this.getError();if(this._restoreError(i),i!==this.NO_ERROR)return;let a=this._getActiveTextureUnit(),o=this._getActiveTexture(e);o!==t&&(o&&(--o._refCount,o._checkDelete()),t&&(t._refCount+=1)),e===this.TEXTURE_2D?a._bind2D=t:e===this.TEXTURE_CUBE_MAP&&(a._bindCube=t)},createTexture(){let e=this._gl.createTexture();if(e<=0)return null;let t=new l(e,this);return this._textures[e]=t,t},deleteTexture(e){if(!r(e))throw TypeError(`deleteTexture(WebGLTexture)`);if(e instanceof l){if(!this._checkOwns(e)){this.setError(this.INVALID_OPERATION);return}}else return;let t=this._activeTextureUnit;for(let t=0;t<this._textureUnits.length;++t){let n=this._textureUnits[t];n._bind2D===e?(this.activeTexture(this.TEXTURE0+t),this.bindTexture(this.TEXTURE_2D,null)):n._bindCube===e&&(this.activeTexture(this.TEXTURE0+t),this.bindTexture(this.TEXTURE_CUBE_MAP,null))}this.activeTexture(this.TEXTURE0+t),this._detachTextureFromAllFramebuffers(e),e._pendingDelete=!0,e._checkDelete()},_detachTextureFromAllFramebuffers(e){let t=this._activeFramebuffer,n=this._getAttachments(),r=!1;for(let i in this._framebuffers){let a=this._framebuffers[i];if(!(!a||!a._linked(e))){a!==t&&(this._gl.bindFramebuffer(this.FRAMEBUFFER,a._|0),r=!0);for(let t=0;t<n.length;++t){let r=n[t];a._attachments[r]===e&&(this._gl.framebufferTexture2D(this.FRAMEBUFFER,r,a._attachmentFace[r]||this.TEXTURE_2D,0,a._attachmentLevel[r]||0),a._setAttachment(null,r))}}}r&&this._gl.bindFramebuffer(this.FRAMEBUFFER,t?t._|0:this._gtkFboId)},pixelStorei(e=0,t=0){if(typeof t==`boolean`&&(t=t===!1?0:1),e===this.UNPACK_ALIGNMENT)if(t===1||t===2||t===4||t===8)this._unpackAlignment=t;else{this.setError(this.INVALID_VALUE);return}else if(e===this.PACK_ALIGNMENT)if(t===1||t===2||t===4||t===8)this._packAlignment=t;else{this.setError(this.INVALID_VALUE);return}else if(e===this.UNPACK_COLORSPACE_CONVERSION_WEBGL){if(!(t===this.NONE||t===this.BROWSER_DEFAULT_WEBGL)){this.setError(this.INVALID_VALUE);return}}else if(e===this.UNPACK_FLIP_Y_WEBGL){this._unpackFlipY=!!t;return}else if(e===this.UNPACK_PREMULTIPLY_ALPHA_WEBGL){this._unpackPremultAlpha=!!t;return}this._gl.pixelStorei(e,t)},texImage2D(t=0,r=0,o=0,l=0,u=0,f=0,p=0,m=0,h){let g=0,_=0,v=0,y,b,x=0;if(arguments.length===6)if(m=u,v=l,f instanceof d.Pixbuf)b=f,g=b.get_width(),_=b.get_height(),h=b.get_pixels();else{y=f;let e=a(y);if(e==null)throw TypeError(`texImage2D(GLenum, GLint, GLenum, GLint, GLenum, GLenum, ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement)`);g=e.width,_=e.height,h=e.data}else arguments.length===9&&(g=l,_=u,x=f,v=p,h=h);if(typeof h!=`object`&&h!==void 0)throw TypeError(`texImage2D(GLenum, GLint, GLenum, GLint, GLint, GLint, GLenum, GLenum, Uint8Array)`);if(!n(this,v)||!n(this,o)){this.setError(this.INVALID_ENUM);return}if(m===this.FLOAT&&!this._extensions.oes_texture_float){this.setError(this.INVALID_ENUM);return}let S=this._getTexImage(t);if(!S||v!==o){this.setError(this.INVALID_OPERATION);return}let C=this._computePixelSize(m,v);if(C===0||!this._checkDimensions(t,g,_,r))return;let w=i(h),T=this._computeRowStride(g,C),E=T*_;if(w&&w.length<E){this.setError(this.INVALID_OPERATION);return}if(x!==0||c(this,t)&&g!==_){this.setError(this.INVALID_VALUE);return}if(this._unpackPremultAlpha&&w&&v===this.RGBA&&(w=s(w)),this._unpackFlipY&&w&&g>0&&_>0){let e=new Uint8Array(w.length);for(let t=0;t<_;t++){let n=t*T,r=(_-1-t)*T;e.set(w.subarray(n,n+T),r)}w=e}this._saveError(),this._gl.texImage2D(t,r,o,g,_,x,v,m,e(w));let D=this.getError();if(this._restoreError(D),D!==this.NO_ERROR)return;S._levelWidth[r]=g,S._levelHeight[r]=_,S._format=v,S._type=m;let O=this._activeFramebuffer;if(O){let e=!1,t=this._getAttachments();for(let n=0;n<t.length;++n)if(O._attachments[t[n]]===S){e=!0;break}e&&this._activeFramebuffer&&this._updateFramebufferAttachments(this._activeFramebuffer)}},texSubImage2D(t=0,n=0,r=0,o=0,c=0,l=0,u=0,f=0,p){let m=0,h=0,g=0,_,v;if(arguments.length===7)if(f=l,g=c,u instanceof d.Pixbuf)v=u,m=v.get_width(),h=v.get_height(),p=v.get_pixels();else{_=u;let e=a(_);if(e==null)throw TypeError(`texSubImage2D(GLenum, GLint, GLint, GLint, GLenum, GLenum, ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement)`);m=e.width,h=e.height,p=e.data}else m=c,h=l,g=u;if(typeof p!=`object`)throw TypeError(`texSubImage2D(GLenum, GLint, GLint, GLint, GLint, GLint, GLenum, GLenum, Uint8Array)`);if(!this._getTexImage(t)){this.setError(this.INVALID_OPERATION);return}if(f===this.FLOAT&&!this._extensions.oes_texture_float){this.setError(this.INVALID_ENUM);return}let y=this._computePixelSize(f,g);if(y===0||!this._checkDimensions(t,m,h,n))return;if(r<0||o<0){this.setError(this.INVALID_VALUE);return}let b=i(p),x=this._computeRowStride(m,y),S=x*h;if(!b||b.length<S){this.setError(this.INVALID_OPERATION);return}if(this._unpackPremultAlpha&&b&&g===this.RGBA&&(b=s(b)),this._unpackFlipY&&b&&m>0&&h>0){let e=new Uint8Array(b.length);for(let t=0;t<h;t++){let n=t*x,r=(h-1-t)*x;e.set(b.subarray(n,n+x),r)}b=e}this._gl.texSubImage2D(t,n,r,o,m,h,g,f,e(b))},copyTexImage2D(e=0,t=0,n=0,r=0,i=0,a=0,o=0,s=0){let c=this._getTexImage(e);if(!c){this.setError(this.INVALID_OPERATION);return}if(n!==this.RGBA&&n!==this.RGB&&n!==this.ALPHA&&n!==this.LUMINANCE&&n!==this.LUMINANCE_ALPHA){this.setError(this.INVALID_ENUM);return}if(t<0||a<0||o<0||s!==0){this.setError(this.INVALID_VALUE);return}if(t>0&&!(u.isPow2(a)&&u.isPow2(o))){this.setError(this.INVALID_VALUE);return}this._saveError(),this._gl.copyTexImage2D(e,t,n,r,i,a,o,s);let l=this.getError();this._restoreError(l),l===this.NO_ERROR&&(c._levelWidth[t]=a,c._levelHeight[t]=o,c._format=this.RGBA,c._type=this.UNSIGNED_BYTE)},copyTexSubImage2D(e=0,t=0,n=0,r=0,i=0,a=0,o=0,s=0){if(!this._getTexImage(e)){this.setError(this.INVALID_OPERATION);return}if(o<0||s<0||n<0||r<0||t<0){this.setError(this.INVALID_VALUE);return}this._gl.copyTexSubImage2D(e,t,n,r,i,a,o,s)},compressedTexImage2D(n,r,i,a,o,s,c){this._gl.compressedTexImage2D(n,r,i,a,o,s,e(t(c)))},compressedTexSubImage2D(n,r,i,a,o,s,c,l){this._gl.compressedTexSubImage2D(n,r,i,a,o,s,c,e(t(l)))},texParameterf(e=0,t=0,n){if(n=+n,this._checkTextureTarget(e)){switch(this._verifyTextureCompleteness(e,t,n),t){case this.TEXTURE_MIN_FILTER:case this.TEXTURE_MAG_FILTER:case this.TEXTURE_WRAP_S:case this.TEXTURE_WRAP_T:this._gl.texParameterf(e,t,n);return}if(this._extensions.ext_texture_filter_anisotropic&&t===this._extensions.ext_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT){this._gl.texParameterf(e,t,n);return}this.setError(this.INVALID_ENUM)}},texParameteri(e=0,t=0,n=0){if(this._checkTextureTarget(e)){switch(this._verifyTextureCompleteness(e,t,n),t){case this.TEXTURE_MIN_FILTER:case this.TEXTURE_MAG_FILTER:case this.TEXTURE_WRAP_S:case this.TEXTURE_WRAP_T:this._gl.texParameteri(e,t,n);return}if(this._extensions.ext_texture_filter_anisotropic&&t===this._extensions.ext_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT){this._gl.texParameteri(e,t,n);return}this.setError(this.INVALID_ENUM)}},getTexParameter(e=0,t=0){if(!this._checkTextureTarget(e))return null;let n=this._getActiveTextureUnit();if(e===this.TEXTURE_2D&&!n._bind2D||e===this.TEXTURE_CUBE_MAP&&!n._bindCube)return this.setError(this.INVALID_OPERATION),null;switch(t){case this.TEXTURE_MAG_FILTER:case this.TEXTURE_MIN_FILTER:case this.TEXTURE_WRAP_S:case this.TEXTURE_WRAP_T:return this._getTexParameterDirect(e,t)}return this._extensions.ext_texture_filter_anisotropic&&t===this._extensions.ext_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT?this._getTexParameterDirect(e,t):(this.setError(this.INVALID_ENUM),null)},_getTexParameterDirect(e=0,t=0){return this._gl.getTexParameterx(e,t)?.unpack()},_getActiveTextureUnit(){return this._textureUnits[this._activeTextureUnit]},_getActiveTexture(e){let t=this._getActiveTextureUnit();return e===this.TEXTURE_2D?t._bind2D:e===this.TEXTURE_CUBE_MAP?t._bindCube:null},_getTexImage(e){let t=this._getActiveTextureUnit();return e===this.TEXTURE_2D?t._bind2D:c(this,e)?t._bindCube:(this.setError(this.INVALID_ENUM),null)},_checkTextureTarget(e){let t=this._getActiveTextureUnit(),n=null;if(e===this.TEXTURE_2D)n=t._bind2D;else if(e===this.TEXTURE_CUBE_MAP)n=t._bindCube;else return this.setError(this.INVALID_ENUM),!1;return n?!0:(this.setError(this.INVALID_OPERATION),!1)},_validTextureTarget(e){return e===this.TEXTURE_2D||e===this.TEXTURE_CUBE_MAP},_validCubeTarget(e){return e===this.TEXTURE_CUBE_MAP_POSITIVE_X||e===this.TEXTURE_CUBE_MAP_NEGATIVE_X||e===this.TEXTURE_CUBE_MAP_POSITIVE_Y||e===this.TEXTURE_CUBE_MAP_NEGATIVE_Y||e===this.TEXTURE_CUBE_MAP_POSITIVE_Z||e===this.TEXTURE_CUBE_MAP_NEGATIVE_Z},_verifyTextureCompleteness(e,t,n){let r=this._getActiveTextureUnit(),i=null;if(e===this.TEXTURE_2D?i=r._bind2D:this._validCubeTarget(e)&&(i=r._bindCube),this._extensions.oes_texture_float&&!this._extensions.oes_texture_float_linear&&i&&i._type===this.FLOAT&&(t===this.TEXTURE_MAG_FILTER||t===this.TEXTURE_MIN_FILTER)&&(n===this.LINEAR||n===this.LINEAR_MIPMAP_NEAREST||n===this.NEAREST_MIPMAP_LINEAR||n===this.LINEAR_MIPMAP_LINEAR)){i._complete=!1,this.bindTexture(e,i);return}i&&i._complete===!1&&(i._complete=!0,this.bindTexture(e,i))},_computePixelSize(e,t){let n=o(this,t);if(n===0)return this.setError(this.INVALID_ENUM),0;switch(e){case this.UNSIGNED_BYTE:return n;case this.UNSIGNED_SHORT_5_6_5:if(t!==this.RGB){this.setError(this.INVALID_OPERATION);break}return 2;case this.UNSIGNED_SHORT_4_4_4_4:case this.UNSIGNED_SHORT_5_5_5_1:if(t!==this.RGBA){this.setError(this.INVALID_OPERATION);break}return 2;case this.FLOAT:return 1}return this.setError(this.INVALID_ENUM),0},_computeRowStride(e,t){let n=e*t;return n%this._unpackAlignment&&(n+=this._unpackAlignment-n%this._unpackAlignment),n},_checkDimensions(e,t,n,r){if(r<0||t<0||n<0)return this.setError(this.INVALID_VALUE),!1;if(e===this.TEXTURE_2D){if(t>this._maxTextureSize||n>this._maxTextureSize||r>this._maxTextureLevel)return this.setError(this.INVALID_VALUE),!1}else if(this._validCubeTarget(e)){if(t>this._maxCubeMapSize||n>this._maxCubeMapSize||r>this._maxCubeMapLevel)return this.setError(this.INVALID_VALUE),!1}else return this.setError(this.INVALID_ENUM),!1;return!0}};function installTextureManagementMethods(e){Object.assign(e,f)}export{installTextureManagementMethods};
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{HTMLCanvasElement as e}from"./html-canvas-element.js";import{notifyElementResize as t}from"@gjsify/dom-elements";import n from"gi://GObject";import r from"gi://GLib?version=2.0";import i from"gi://Gtk?version=4.0";import{attachEventControllers as a}from"@gjsify/event-bridge";import{Event as o}from"@gjsify/dom-events";const s=n.registerClass({GTypeName:`GjsifyWebGLBridge`},class WebGLBridge extends i.GLArea{constructor(n){super(n),this._canvas=null,this._readyCallbacks=[],this._resizeCallbacks=[],this._renderTag=null,this._tickCallbackId=null,this._frameCallback=null,this._timeOrigin=r.get_monotonic_time(),this.set_use_es(!0),this.set_required_version(3,2),this.set_has_depth_buffer(!0),this.set_has_stencil_buffer(!0),a(this,()=>this._canvas,{captureKeys:!0}),this._tickCallbackId=this.add_tick_callback((e,t)=>(this._frameCallback!==null&&this.queue_render(),r.SOURCE_CONTINUE));let i=this.connect(`render`,()=>{this.disconnect(i),this.make_current(),this._canvas=new e(this);{let e=globalThis;e.document?.body&&e.document.body.appendChild(this._canvas)}this._canvas.getContext(`webgl2`);let t=this._canvas.getContext(`webgl`);if(t){for(let e of this._readyCallbacks)e(this._canvas,t);this._readyCallbacks=[]}return this._renderTag=this.connect(`render`,e=>{if(this._frameCallback!==null){let e=(r.get_monotonic_time()-this._timeOrigin)/1e3;globalThis.__GJSIFY_DEBUG_RAF===!0&&console.log(`[rAF] frame callback fires t=${e.toFixed(1)}`);let t=this._frameCallback;this._frameCallback=null,t(e)}return!0}),!0});this.connect(`resize`,()=>{let e=this.get_allocated_width(),n=this.get_allocated_height();this._canvas&&(this._canvas.dispatchEvent(new o(`resize`)),t(this._canvas,e,n));for(let t of this._resizeCallbacks)t(e,n);this._frameCallback&&this.requestAnimationFrame(this._frameCallback)}),this.connect(`unrealize`,()=>{this._renderTag!==null&&(this.disconnect(this._renderTag),this._renderTag=null),this._tickCallbackId!==null&&(this.remove_tick_callback(this._tickCallbackId),this._tickCallbackId=null),this._canvas=null})}get canvas(){return this._canvas}onReady(e){if(this._canvas){let t=this._canvas.getContext(`webgl`);if(t){e(this._canvas,t);return}}this._readyCallbacks.push(e)}onWebGLReady(e){this.onReady(e)}onResize(e){this._resizeCallbacks.push(e)}requestAnimationFrame(e){return this._frameCallback=e,this.queue_render(),0}installGlobals(){let e=globalThis;e.requestAnimationFrame=e=>this.requestAnimationFrame(e),e.cancelAnimationFrame=e=>{this._frameCallback=null};let t=this._timeOrigin;e.performance={now:()=>(r.get_monotonic_time()-t)/1e3,timeOrigin:Date.now()}}});export{s as WebGLBridge};
1
+ import"./_virtual/_rolldown/runtime.js";import{HTMLCanvasElement as e}from"./html-canvas-element.js";import{notifyElementResize as t}from"@gjsify/dom-elements";import n from"gi://GObject";import r from"gi://GLib?version=2.0";import i from"gi://Gtk?version=4.0";import{attachEventControllers as a}from"@gjsify/event-bridge";import{Event as o}from"@gjsify/dom-events";const s=n.registerClass({GTypeName:`GjsifyWebGLBridge`},class WebGLBridge extends i.GLArea{constructor(n){super(n),this._canvas=null,this._readyCallbacks=[],this._resizeCallbacks=[],this._renderTag=null,this._tickCallbackId=null,this._frameCallback=null,this._frameCallbackId=0,this._nextFrameId=1,this._timeOrigin=r.get_monotonic_time(),this.set_use_es(!0),this.set_required_version(3,2),this.set_has_depth_buffer(!0),this.set_has_stencil_buffer(!0),a(this,()=>this._canvas,{captureKeys:!0}),this._tickCallbackId=this.add_tick_callback((e,t)=>(this._frameCallback!==null&&this.queue_render(),r.SOURCE_CONTINUE));let i=this.connect(`render`,()=>{this.disconnect(i),this.make_current(),this._canvas=new e(this);{let e=globalThis;e.document?.body&&e.document.body.appendChild(this._canvas)}this._canvas.getContext(`webgl2`);let t=this._canvas.getContext(`webgl`);if(t){for(let e of this._readyCallbacks)e(this._canvas,t);this._readyCallbacks=[]}return this._renderTag=this.connect(`render`,e=>{if(this._frameCallback!==null){let e=(r.get_monotonic_time()-this._timeOrigin)/1e3;globalThis.__GJSIFY_DEBUG_RAF===!0&&console.log(`[rAF] frame callback fires t=${e.toFixed(1)}`);let t=this._frameCallback;this._frameCallback=null,this._frameCallbackId=0,t(e)}return!0}),!0});this.connect(`resize`,()=>{let e=this.get_allocated_width(),n=this.get_allocated_height();this._canvas&&(this._canvas.dispatchEvent(new o(`resize`)),t(this._canvas,e,n));for(let t of this._resizeCallbacks)t(e,n);this._frameCallback&&this.requestAnimationFrame(this._frameCallback)}),this.connect(`unrealize`,()=>{this._renderTag!==null&&(this.disconnect(this._renderTag),this._renderTag=null),this._tickCallbackId!==null&&(this.remove_tick_callback(this._tickCallbackId),this._tickCallbackId=null),this._canvas=null})}get canvas(){return this._canvas}onReady(e){if(this._canvas){let t=this._canvas.getContext(`webgl`);if(t){e(this._canvas,t);return}}this._readyCallbacks.push(e)}onWebGLReady(e){this.onReady(e)}onResize(e){this._resizeCallbacks.push(e)}requestAnimationFrame(e){let t=this._nextFrameId++;return this._frameCallback=e,this._frameCallbackId=t,this.queue_render(),t}cancelAnimationFrame(e){e!==0&&e===this._frameCallbackId&&(this._frameCallback=null,this._frameCallbackId=0)}installGlobals(){let e=globalThis;e.requestAnimationFrame=e=>this.requestAnimationFrame(e),e.cancelAnimationFrame=e=>this.cancelAnimationFrame(e);let t=this._timeOrigin;e.performance={now:()=>(r.get_monotonic_time()-t)/1e3,timeOrigin:Date.now()}}});export{s as WebGLBridge};
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";var WebGLContextAttributes=class{constructor(e,t,n,r,i,a,o,s){this.alpha=e,this.depth=t,this.stencil=n,this.antialias=r,this.premultipliedAlpha=i,this.preserveDrawingBuffer=a,this.preferLowPowerToHighPerformance=o,this.failIfMajorPerformanceCaveat=s,this.alpha=e,this.depth=t,this.stencil=n,this.antialias=r,this.premultipliedAlpha=i,this.preserveDrawingBuffer=a,this.preferLowPowerToHighPerformance=o,this.failIfMajorPerformanceCaveat=s}};export{WebGLContextAttributes};
1
+ import"./_virtual/_rolldown/runtime.js";var WebGLContextAttributes=class{constructor(e,t,n,r,i,a,o,s){this.alpha=e,this.depth=t,this.stencil=n,this.antialias=r,this.premultipliedAlpha=i,this.preserveDrawingBuffer=a,this.preferLowPowerToHighPerformance=o,this.failIfMajorPerformanceCaveat=s}};export{WebGLContextAttributes};
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{WebGLContextAttributes as e}from"./webgl-context-attributes.js";import{flag as t}from"./utils.js";import{getOESElementIndexUint as n}from"./extensions/oes-element-index-unit.js";import{getOESStandardDerivatives as r}from"./extensions/oes-standard-derivatives.js";import{getOESTextureFloat as i}from"./extensions/oes-texture-float.js";import{getOESTextureFloatLinear as a}from"./extensions/oes-texture-float-linear.js";import{getSTACKGLDestroyContext as o}from"./extensions/stackgl-destroy-context.js";import{getSTACKGLResizeDrawingBuffer as s}from"./extensions/stackgl-resize-drawing-buffer.js";import{getEXTBlendMinMax as c}from"./extensions/ext-blend-minmax.js";import{getEXTColorBufferFloat as l}from"./extensions/ext-color-buffer-float.js";import{getEXTColorBufferHalfFloat as u}from"./extensions/ext-color-buffer-half-float.js";import{getEXTTextureFilterAnisotropic as d}from"./extensions/ext-texture-filter-anisotropic.js";import{getOESTextureHalfFloat as f}from"./extensions/oes-texture-half-float.js";import{WebGLTextureUnit as p}from"./webgl-texture-unit.js";import{WebGLVertexArrayGlobalState as m,WebGLVertexArrayObjectState as h}from"./webgl-vertex-attribute.js";import{installAllContextMethods as g}from"./context/index.js";import _ from"@girs/gwebgl-0.1";import"@girs/gdkpixbuf-2.0";import*as v from"bit-twiddle";import{warnNotImplemented as y}from"@gjsify/utils";let b=0;const x={oes_element_index_uint:n,oes_texture_float:i,oes_texture_float_linear:a,oes_standard_derivatives:r,stackgl_destroy_context:o,stackgl_resize_drawingbuffer:s,ext_blend_minmax:c,ext_color_buffer_float:l,ext_color_buffer_half_float:u,ext_texture_filter_anisotropic:d,oes_texture_half_float:f};var WebGLContextBase=class{get drawingBufferHeight(){return this.canvas.height||0}get drawingBufferWidth(){return this.canvas.width||0}constructor(n,r={}){this.unpackColorSpace=`srgb`,this.RGBA8=32856,this.DEFAULT_ATTACHMENTS=[],this.DEFAULT_COLOR_ATTACHMENTS=[],this._=0,this._extensions={},this._programs={},this._shaders={},this._textures={},this._framebuffers={},this._renderbuffers={},this._buffers={},this._activeProgram=null,this._activeFramebuffer=null,this._activeRenderbuffer=null,this._checkStencil=!1,this._stencilState=!0,this._activeTextureUnit=0,this._errorStack=[],this._maxTextureSize=0,this._maxTextureLevel=0,this._maxCubeMapSize=0,this._maxCubeMapLevel=0,this._maxRenderbufferSize=0,this._unpackAlignment=4,this._packAlignment=4,this._unpackFlipY=!1,this._unpackPremultAlpha=!1,this._viewport=new Int32Array([0,0,0,0]),this._scissorBox=new Int32Array([0,0,0,0]),this._gtkFboId=0,this._textureUnits=[],this._drawingBuffer=null,this.canvas=n,this._contextAttributes=new e(t(r,`alpha`,!0),t(r,`depth`,!0),t(r,`stencil`,!1),!1,t(r,`premultipliedAlpha`,!0),t(r,`preserveDrawingBuffer`,!1),t(r,`preferLowPowerToHighPerformance`,!1),t(r,`failIfMajorPerformanceCaveat`,!1)),this._contextAttributes.premultipliedAlpha=this._contextAttributes.premultipliedAlpha&&this._contextAttributes.alpha}_init(){let e=this._gl.getParameterx(36006);this._gtkFboId=e?.deepUnpack()|0,this._initGLConstants(),this.DEFAULT_ATTACHMENTS=[this.COLOR_ATTACHMENT0,this.DEPTH_ATTACHMENT,this.STENCIL_ATTACHMENT,this.DEPTH_STENCIL_ATTACHMENT],this.DEFAULT_COLOR_ATTACHMENTS=[this.COLOR_ATTACHMENT0];let t=this.drawingBufferWidth||0,n=this.drawingBufferHeight||0;this._=b++;let r=this.getParameter(this.MAX_COMBINED_TEXTURE_IMAGE_UNITS);this._textureUnits=Array(r);for(let e=0;e<r;++e)this._textureUnits[e]=new p(this,e);this.activeTexture(this.TEXTURE0),this._defaultVertexObjectState=new h(this),this._vertexObjectState=this._defaultVertexObjectState,this._vertexGlobalState=new m(this),this._maxTextureSize=this.getParameter(this.MAX_TEXTURE_SIZE),this._maxTextureLevel=v.log2(v.nextPow2(this._maxTextureSize)),this._maxCubeMapSize=this.getParameter(this.MAX_CUBE_MAP_TEXTURE_SIZE),this._maxCubeMapLevel=v.log2(v.nextPow2(this._maxCubeMapSize)),this._maxRenderbufferSize=this.getParameter(this.MAX_RENDERBUFFER_SIZE),this._unpackAlignment=4,this._packAlignment=4,this._unpackFlipY=!1,this._unpackPremultAlpha=!1,this.bindBuffer(this.ARRAY_BUFFER,null),this.bindBuffer(this.ELEMENT_ARRAY_BUFFER,null),this.bindFramebuffer(this.FRAMEBUFFER,null),this.bindRenderbuffer(this.RENDERBUFFER,null),this.viewport(0,0,t,n),this.scissor(0,0,t,n),this.clearDepth(1),this.clearColor(0,0,0,0),this.clearStencil(0),this.clear(this.COLOR_BUFFER_BIT|this.DEPTH_BUFFER_BIT|this.STENCIL_BUFFER_BIT),this.disable(this.DEPTH_TEST),this.disable(this.STENCIL_TEST),this.disable(this.BLEND),this.disable(this.CULL_FACE),this.disable(this.POLYGON_OFFSET_FILL),this.disable(this.SCISSOR_TEST),this._gl.colorMask(!0,!0,!0,!0)}_initGLConstants(){let e=new _.WebGLRenderingContextBase().get_webgl_constants();for(let[t,n]of Object.entries(e))Object.defineProperty(this,t,{value:n})}_getGlslVersion(e){return e?`100`:`120`}_checkOwns(e){return typeof e==`object`&&!!e&&e._ctx===this}_checkValid(e,t){return e instanceof t&&e._!==0}_checkWrapper(e,t){return this._checkValid(e,t)?this._checkOwns(e)?!0:(this.setError(this.INVALID_OPERATION),!1):(this.setError(this.INVALID_VALUE),!1)}_isObject(e,t,n){if(e!=null&&!(e instanceof n))throw TypeError(t+`(`+n.name+`)`);return!!(this._checkValid(e,n)&&this._checkOwns(e))}_checkStencilState(){return this._checkStencil?(this._checkStencil=!1,this._stencilState=!0,(this.getParameter(this.STENCIL_WRITEMASK)!==this.getParameter(this.STENCIL_BACK_WRITEMASK)||this.getParameter(this.STENCIL_VALUE_MASK)!==this.getParameter(this.STENCIL_BACK_VALUE_MASK)||this.getParameter(this.STENCIL_REF)!==this.getParameter(this.STENCIL_BACK_REF))&&(this.setError(this.INVALID_OPERATION),this._stencilState=!1),this._stencilState):this._stencilState}_validGLSLIdentifier(e){return!(e.indexOf(`webgl_`)===0||e.indexOf(`_webgl_`)===0||e.length>256)}_getParameterDirect(e){return this._gl.getParameterx(e)?.deepUnpack()}getContextAttributes(){return this._contextAttributes}getExtension(e){let t=e.toLowerCase();if(t in this._extensions)return this._extensions[t];let n=x[t]?x[t](this):null;return n&&(this._extensions[t]=n),n}getSupportedExtensions(){let e=[`ANGLE_instanced_arrays`,`STACKGL_resize_drawingbuffer`,`STACKGL_destroy_context`],t=this._gl.getSupportedExtensions();return t?(t.indexOf(`GL_OES_element_index_uint`)>=0&&e.push(`OES_element_index_uint`),t.indexOf(`GL_OES_standard_derivatives`)>=0&&e.push(`OES_standard_derivatives`),t.indexOf(`GL_OES_texture_float`)>=0&&e.push(`OES_texture_float`),t.indexOf(`GL_OES_texture_float_linear`)>=0&&e.push(`OES_texture_float_linear`),(t.indexOf(`GL_OES_texture_half_float`)>=0||t.indexOf(`GL_ARB_half_float_pixel`)>=0)&&e.push(`OES_texture_half_float`),(t.indexOf(`GL_EXT_color_buffer_float`)>=0||t.indexOf(`GL_ARB_color_buffer_float`)>=0)&&e.push(`EXT_color_buffer_float`),t.indexOf(`GL_EXT_color_buffer_half_float`)>=0&&e.push(`EXT_color_buffer_half_float`),t.indexOf(`EXT_draw_buffers`)>=0&&e.push(`WEBGL_draw_buffers`),t.indexOf(`EXT_blend_minmax`)>=0&&e.push(`EXT_blend_minmax`),t.indexOf(`EXT_texture_filter_anisotropic`)>=0&&e.push(`EXT_texture_filter_anisotropic`),t.indexOf(`GL_OES_vertex_array_object`)>=0&&e.push(`OES_vertex_array_object`),e):e}getParameter(e=0){switch(e){case this.ARRAY_BUFFER_BINDING:return this._vertexGlobalState._arrayBufferBinding;case this.ELEMENT_ARRAY_BUFFER_BINDING:return this._vertexObjectState._elementArrayBufferBinding;case this.CURRENT_PROGRAM:return this._activeProgram;case this.FRAMEBUFFER_BINDING:return this._activeFramebuffer;case this.RENDERBUFFER_BINDING:return this._activeRenderbuffer;case this.TEXTURE_BINDING_2D:return this._getActiveTextureUnit()._bind2D;case this.TEXTURE_BINDING_CUBE_MAP:return this._getActiveTextureUnit()._bindCube;case this.VERSION:return`WebGL 1.0 0.0.1`;case this.VENDOR:return``;case this.RENDERER:return`ANGLE`;case this.SHADING_LANGUAGE_VERSION:return`WebGL GLSL ES 1.0 `;case this.COMPRESSED_TEXTURE_FORMATS:return new Uint32Array;case this.SCISSOR_BOX:return new Int32Array(this._scissorBox);case this.VIEWPORT:return new Int32Array(this._viewport);case this.MAX_VIEWPORT_DIMS:return new Int32Array([32767,32767]);case this.ALIASED_LINE_WIDTH_RANGE:case this.ALIASED_POINT_SIZE_RANGE:return new Float32Array([1,1]);case this.DEPTH_RANGE:return new Float32Array([0,1]);case this.BLEND_COLOR:case this.COLOR_CLEAR_VALUE:return new Float32Array(this._gl.getParameterfv(e,4));case this.COLOR_WRITEMASK:{let t=this._gl.getParameteriv(e,4);return[!!t[0],!!t[1],!!t[2],!!t[3]]}case this.DEPTH_CLEAR_VALUE:case this.LINE_WIDTH:case this.POLYGON_OFFSET_FACTOR:case this.POLYGON_OFFSET_UNITS:case this.SAMPLE_COVERAGE_VALUE:return this._gl.getParameterf(e);case this.BLEND:case this.CULL_FACE:case this.DEPTH_TEST:case this.DEPTH_WRITEMASK:case this.DITHER:case this.POLYGON_OFFSET_FILL:case this.SAMPLE_COVERAGE_INVERT:case this.SCISSOR_TEST:case this.STENCIL_TEST:case this.UNPACK_PREMULTIPLY_ALPHA_WEBGL:return!!this._gl.getParameteri(e);case this.UNPACK_FLIP_Y_WEBGL:return this._unpackFlipY;case this.ACTIVE_TEXTURE:case this.ALPHA_BITS:case this.BLEND_DST_ALPHA:case this.BLEND_DST_RGB:case this.BLEND_EQUATION_ALPHA:case this.BLEND_EQUATION_RGB:case this.BLEND_SRC_ALPHA:case this.BLEND_SRC_RGB:case this.BLUE_BITS:case this.CULL_FACE_MODE:case this.DEPTH_BITS:case this.DEPTH_FUNC:case this.FRONT_FACE:case this.GENERATE_MIPMAP_HINT:case this.GREEN_BITS:case this.MAX_COMBINED_TEXTURE_IMAGE_UNITS:case this.MAX_CUBE_MAP_TEXTURE_SIZE:case this.MAX_FRAGMENT_UNIFORM_VECTORS:case this.MAX_RENDERBUFFER_SIZE:case this.MAX_TEXTURE_IMAGE_UNITS:case this.MAX_TEXTURE_SIZE:case this.MAX_VARYING_VECTORS:case this.MAX_VERTEX_ATTRIBS:case this.MAX_VERTEX_TEXTURE_IMAGE_UNITS:case this.MAX_VERTEX_UNIFORM_VECTORS:case this.PACK_ALIGNMENT:case this.RED_BITS:case this.SAMPLE_BUFFERS:case this.SAMPLES:case this.STENCIL_BACK_FAIL:case this.STENCIL_BACK_FUNC:case this.STENCIL_BACK_PASS_DEPTH_FAIL:case this.STENCIL_BACK_PASS_DEPTH_PASS:case this.STENCIL_BACK_REF:case this.STENCIL_BACK_VALUE_MASK:case this.STENCIL_BACK_WRITEMASK:case this.STENCIL_BITS:case this.STENCIL_CLEAR_VALUE:case this.STENCIL_FAIL:case this.STENCIL_FUNC:case this.STENCIL_PASS_DEPTH_FAIL:case this.STENCIL_PASS_DEPTH_PASS:case this.STENCIL_REF:case this.STENCIL_VALUE_MASK:case this.STENCIL_WRITEMASK:case this.SUBPIXEL_BITS:case this.UNPACK_ALIGNMENT:case this.UNPACK_COLORSPACE_CONVERSION_WEBGL:return this._gl.getParameteri(e);case this.IMPLEMENTATION_COLOR_READ_FORMAT:case this.IMPLEMENTATION_COLOR_READ_TYPE:return this._getParameterDirect(e);default:if(this._extensions.webgl_draw_buffers){let t=this._extensions.webgl_draw_buffers;switch(e){case t.DRAW_BUFFER0_WEBGL:case t.DRAW_BUFFER1_WEBGL:case t.DRAW_BUFFER2_WEBGL:case t.DRAW_BUFFER3_WEBGL:case t.DRAW_BUFFER4_WEBGL:case t.DRAW_BUFFER5_WEBGL:case t.DRAW_BUFFER6_WEBGL:case t.DRAW_BUFFER7_WEBGL:case t.DRAW_BUFFER8_WEBGL:case t.DRAW_BUFFER9_WEBGL:case t.DRAW_BUFFER10_WEBGL:case t.DRAW_BUFFER11_WEBGL:case t.DRAW_BUFFER12_WEBGL:case t.DRAW_BUFFER13_WEBGL:case t.DRAW_BUFFER14_WEBGL:case t.DRAW_BUFFER15_WEBGL:return t._buffersState.length===1&&t._buffersState[0]===this.BACK?this.BACK:this._getParameterDirect(e);case t.MAX_DRAW_BUFFERS_WEBGL:case t.MAX_COLOR_ATTACHMENTS_WEBGL:return this._getParameterDirect(e)}}return this._extensions.oes_standard_derivatives&&e===this._extensions.oes_standard_derivatives.FRAGMENT_SHADER_DERIVATIVE_HINT_OES||this._extensions.ext_texture_filter_anisotropic&&e===this._extensions.ext_texture_filter_anisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT?this._getParameterDirect(e):this._extensions.oes_vertex_array_object&&e===this._extensions.oes_vertex_array_object.VERTEX_ARRAY_BINDING_OES?this._extensions.oes_vertex_array_object._activeVertexArrayObject:(this.setError(this.INVALID_ENUM),null)}}destroy(){y(`destroy`)}};g(WebGLContextBase.prototype);export{WebGLContextBase};
1
+ import"./_virtual/_rolldown/runtime.js";import{WebGLContextAttributes as e}from"./webgl-context-attributes.js";import{flag as t}from"./utils.js";import{getOESElementIndexUint as n}from"./extensions/oes-element-index-unit.js";import{getOESStandardDerivatives as r}from"./extensions/oes-standard-derivatives.js";import{getOESTextureFloat as i}from"./extensions/oes-texture-float.js";import{getOESTextureFloatLinear as a}from"./extensions/oes-texture-float-linear.js";import{getSTACKGLDestroyContext as o}from"./extensions/stackgl-destroy-context.js";import{getSTACKGLResizeDrawingBuffer as s}from"./extensions/stackgl-resize-drawing-buffer.js";import{getEXTBlendMinMax as c}from"./extensions/ext-blend-minmax.js";import{getEXTColorBufferFloat as l}from"./extensions/ext-color-buffer-float.js";import{getEXTColorBufferHalfFloat as u}from"./extensions/ext-color-buffer-half-float.js";import{getEXTTextureFilterAnisotropic as d}from"./extensions/ext-texture-filter-anisotropic.js";import{getOESTextureHalfFloat as f}from"./extensions/oes-texture-half-float.js";import{WebGLTextureUnit as p}from"./webgl-texture-unit.js";import{WebGLVertexArrayGlobalState as m,WebGLVertexArrayObjectState as h}from"./webgl-vertex-attribute.js";import{installAllContextMethods as g}from"./context/index.js";import _ from"@girs/gwebgl-0.1";import"@girs/gdkpixbuf-2.0";import*as v from"bit-twiddle";import{warnNotImplemented as y}from"@gjsify/utils";let b=0;const x={oes_element_index_uint:n,oes_texture_float:i,oes_texture_float_linear:a,oes_standard_derivatives:r,stackgl_destroy_context:o,stackgl_resize_drawingbuffer:s,ext_blend_minmax:c,ext_color_buffer_float:l,ext_color_buffer_half_float:u,ext_texture_filter_anisotropic:d,oes_texture_half_float:f};var WebGLContextBase=class{get drawingBufferHeight(){return this.canvas.height||0}get drawingBufferWidth(){return this.canvas.width||0}constructor(n,r={}){this.unpackColorSpace=`srgb`,this.RGBA8=32856,this.DEFAULT_ATTACHMENTS=[],this.DEFAULT_COLOR_ATTACHMENTS=[],this._=0,this._extensions={},this._programs={},this._shaders={},this._textures={},this._framebuffers={},this._renderbuffers={},this._buffers={},this._activeProgram=null,this._activeFramebuffer=null,this._activeRenderbuffer=null,this._checkStencil=!1,this._stencilState=!0,this._activeTextureUnit=0,this._errorStack=[],this._maxTextureSize=0,this._maxTextureLevel=0,this._maxCubeMapSize=0,this._maxCubeMapLevel=0,this._maxRenderbufferSize=0,this._unpackAlignment=4,this._packAlignment=4,this._unpackFlipY=!1,this._unpackPremultAlpha=!1,this._viewport=new Int32Array([0,0,0,0]),this._scissorBox=new Int32Array([0,0,0,0]),this._gtkFboId=0,this._textureUnits=[],this._drawingBuffer=null,this.canvas=n,this._contextAttributes=new e(t(r,`alpha`,!0),t(r,`depth`,!0),t(r,`stencil`,!1),!1,t(r,`premultipliedAlpha`,!0),t(r,`preserveDrawingBuffer`,!1),t(r,`preferLowPowerToHighPerformance`,!1),t(r,`failIfMajorPerformanceCaveat`,!1)),this._contextAttributes.premultipliedAlpha=this._contextAttributes.premultipliedAlpha&&this._contextAttributes.alpha}_init(){let e=this._gl.getParameterx(36006);this._gtkFboId=e?.deepUnpack()|0,this._initGLConstants(),this.DEFAULT_ATTACHMENTS=[this.COLOR_ATTACHMENT0,this.DEPTH_ATTACHMENT,this.STENCIL_ATTACHMENT,this.DEPTH_STENCIL_ATTACHMENT],this.DEFAULT_COLOR_ATTACHMENTS=[this.COLOR_ATTACHMENT0];let t=this.drawingBufferWidth||0,n=this.drawingBufferHeight||0;this._=b++;let r=this.getParameter(this.MAX_COMBINED_TEXTURE_IMAGE_UNITS);this._textureUnits=Array.from({length:r});for(let e=0;e<r;++e)this._textureUnits[e]=new p(this,e);this.activeTexture(this.TEXTURE0),this._defaultVertexObjectState=new h(this),this._vertexObjectState=this._defaultVertexObjectState,this._vertexGlobalState=new m(this),this._maxTextureSize=this.getParameter(this.MAX_TEXTURE_SIZE),this._maxTextureLevel=v.log2(v.nextPow2(this._maxTextureSize)),this._maxCubeMapSize=this.getParameter(this.MAX_CUBE_MAP_TEXTURE_SIZE),this._maxCubeMapLevel=v.log2(v.nextPow2(this._maxCubeMapSize)),this._maxRenderbufferSize=this.getParameter(this.MAX_RENDERBUFFER_SIZE),this._unpackAlignment=4,this._packAlignment=4,this._unpackFlipY=!1,this._unpackPremultAlpha=!1,this.bindBuffer(this.ARRAY_BUFFER,null),this.bindBuffer(this.ELEMENT_ARRAY_BUFFER,null),this.bindFramebuffer(this.FRAMEBUFFER,null),this.bindRenderbuffer(this.RENDERBUFFER,null),this.viewport(0,0,t,n),this.scissor(0,0,t,n),this.clearDepth(1),this.clearColor(0,0,0,0),this.clearStencil(0),this.clear(this.COLOR_BUFFER_BIT|this.DEPTH_BUFFER_BIT|this.STENCIL_BUFFER_BIT),this.disable(this.DEPTH_TEST),this.disable(this.STENCIL_TEST),this.disable(this.BLEND),this.disable(this.CULL_FACE),this.disable(this.POLYGON_OFFSET_FILL),this.disable(this.SCISSOR_TEST),this._gl.colorMask(!0,!0,!0,!0)}_initGLConstants(){let e=new _.WebGLRenderingContextBase().get_webgl_constants();for(let[t,n]of Object.entries(e))Object.defineProperty(this,t,{value:n})}_getGlslVersion(e){return e?`100`:`120`}_checkOwns(e){return typeof e==`object`&&!!e&&e._ctx===this}_checkValid(e,t){return e instanceof t&&e._!==0}_checkWrapper(e,t){return this._checkValid(e,t)?this._checkOwns(e)?!0:(this.setError(this.INVALID_OPERATION),!1):(this.setError(this.INVALID_VALUE),!1)}_isObject(e,t,n){if(e!=null&&!(e instanceof n))throw TypeError(t+`(`+n.name+`)`);return!!(this._checkValid(e,n)&&this._checkOwns(e))}_checkStencilState(){return this._checkStencil?(this._checkStencil=!1,this._stencilState=!0,(this.getParameter(this.STENCIL_WRITEMASK)!==this.getParameter(this.STENCIL_BACK_WRITEMASK)||this.getParameter(this.STENCIL_VALUE_MASK)!==this.getParameter(this.STENCIL_BACK_VALUE_MASK)||this.getParameter(this.STENCIL_REF)!==this.getParameter(this.STENCIL_BACK_REF))&&(this.setError(this.INVALID_OPERATION),this._stencilState=!1),this._stencilState):this._stencilState}_validGLSLIdentifier(e){return!(e.indexOf(`webgl_`)===0||e.indexOf(`_webgl_`)===0||e.length>256)}_getParameterDirect(e){return this._gl.getParameterx(e)?.deepUnpack()}getContextAttributes(){return this._contextAttributes}getExtension(e){let t=e.toLowerCase();if(t in this._extensions)return this._extensions[t];let n=x[t]?x[t](this):null;return n&&(this._extensions[t]=n),n}getSupportedExtensions(){let e=[`ANGLE_instanced_arrays`,`STACKGL_resize_drawingbuffer`,`STACKGL_destroy_context`],t=this._gl.getSupportedExtensions();return t?(t.indexOf(`GL_OES_element_index_uint`)>=0&&e.push(`OES_element_index_uint`),t.indexOf(`GL_OES_standard_derivatives`)>=0&&e.push(`OES_standard_derivatives`),t.indexOf(`GL_OES_texture_float`)>=0&&e.push(`OES_texture_float`),t.indexOf(`GL_OES_texture_float_linear`)>=0&&e.push(`OES_texture_float_linear`),(t.indexOf(`GL_OES_texture_half_float`)>=0||t.indexOf(`GL_ARB_half_float_pixel`)>=0)&&e.push(`OES_texture_half_float`),(t.indexOf(`GL_EXT_color_buffer_float`)>=0||t.indexOf(`GL_ARB_color_buffer_float`)>=0)&&e.push(`EXT_color_buffer_float`),t.indexOf(`GL_EXT_color_buffer_half_float`)>=0&&e.push(`EXT_color_buffer_half_float`),t.indexOf(`EXT_draw_buffers`)>=0&&e.push(`WEBGL_draw_buffers`),t.indexOf(`EXT_blend_minmax`)>=0&&e.push(`EXT_blend_minmax`),t.indexOf(`EXT_texture_filter_anisotropic`)>=0&&e.push(`EXT_texture_filter_anisotropic`),t.indexOf(`GL_OES_vertex_array_object`)>=0&&e.push(`OES_vertex_array_object`),e):e}getParameter(e=0){switch(e){case this.ARRAY_BUFFER_BINDING:return this._vertexGlobalState._arrayBufferBinding;case this.ELEMENT_ARRAY_BUFFER_BINDING:return this._vertexObjectState._elementArrayBufferBinding;case this.CURRENT_PROGRAM:return this._activeProgram;case this.FRAMEBUFFER_BINDING:return this._activeFramebuffer;case this.RENDERBUFFER_BINDING:return this._activeRenderbuffer;case this.TEXTURE_BINDING_2D:return this._getActiveTextureUnit()._bind2D;case this.TEXTURE_BINDING_CUBE_MAP:return this._getActiveTextureUnit()._bindCube;case this.VERSION:return`WebGL 1.0 0.0.1`;case this.VENDOR:return``;case this.RENDERER:return`ANGLE`;case this.SHADING_LANGUAGE_VERSION:return`WebGL GLSL ES 1.0 `;case this.COMPRESSED_TEXTURE_FORMATS:return new Uint32Array;case this.SCISSOR_BOX:return new Int32Array(this._scissorBox);case this.VIEWPORT:return new Int32Array(this._viewport);case this.MAX_VIEWPORT_DIMS:return new Int32Array([32767,32767]);case this.ALIASED_LINE_WIDTH_RANGE:case this.ALIASED_POINT_SIZE_RANGE:return new Float32Array([1,1]);case this.DEPTH_RANGE:return new Float32Array([0,1]);case this.BLEND_COLOR:case this.COLOR_CLEAR_VALUE:return new Float32Array(this._gl.getParameterfv(e,4));case this.COLOR_WRITEMASK:{let t=this._gl.getParameteriv(e,4);return[!!t[0],!!t[1],!!t[2],!!t[3]]}case this.DEPTH_CLEAR_VALUE:case this.LINE_WIDTH:case this.POLYGON_OFFSET_FACTOR:case this.POLYGON_OFFSET_UNITS:case this.SAMPLE_COVERAGE_VALUE:return this._gl.getParameterf(e);case this.BLEND:case this.CULL_FACE:case this.DEPTH_TEST:case this.DEPTH_WRITEMASK:case this.DITHER:case this.POLYGON_OFFSET_FILL:case this.SAMPLE_COVERAGE_INVERT:case this.SCISSOR_TEST:case this.STENCIL_TEST:case this.UNPACK_PREMULTIPLY_ALPHA_WEBGL:return!!this._gl.getParameteri(e);case this.UNPACK_FLIP_Y_WEBGL:return this._unpackFlipY;case this.ACTIVE_TEXTURE:case this.ALPHA_BITS:case this.BLEND_DST_ALPHA:case this.BLEND_DST_RGB:case this.BLEND_EQUATION_ALPHA:case this.BLEND_EQUATION_RGB:case this.BLEND_SRC_ALPHA:case this.BLEND_SRC_RGB:case this.BLUE_BITS:case this.CULL_FACE_MODE:case this.DEPTH_BITS:case this.DEPTH_FUNC:case this.FRONT_FACE:case this.GENERATE_MIPMAP_HINT:case this.GREEN_BITS:case this.MAX_COMBINED_TEXTURE_IMAGE_UNITS:case this.MAX_CUBE_MAP_TEXTURE_SIZE:case this.MAX_FRAGMENT_UNIFORM_VECTORS:case this.MAX_RENDERBUFFER_SIZE:case this.MAX_TEXTURE_IMAGE_UNITS:case this.MAX_TEXTURE_SIZE:case this.MAX_VARYING_VECTORS:case this.MAX_VERTEX_ATTRIBS:case this.MAX_VERTEX_TEXTURE_IMAGE_UNITS:case this.MAX_VERTEX_UNIFORM_VECTORS:case this.PACK_ALIGNMENT:case this.RED_BITS:case this.SAMPLE_BUFFERS:case this.SAMPLES:case this.STENCIL_BACK_FAIL:case this.STENCIL_BACK_FUNC:case this.STENCIL_BACK_PASS_DEPTH_FAIL:case this.STENCIL_BACK_PASS_DEPTH_PASS:case this.STENCIL_BACK_REF:case this.STENCIL_BACK_VALUE_MASK:case this.STENCIL_BACK_WRITEMASK:case this.STENCIL_BITS:case this.STENCIL_CLEAR_VALUE:case this.STENCIL_FAIL:case this.STENCIL_FUNC:case this.STENCIL_PASS_DEPTH_FAIL:case this.STENCIL_PASS_DEPTH_PASS:case this.STENCIL_REF:case this.STENCIL_VALUE_MASK:case this.STENCIL_WRITEMASK:case this.SUBPIXEL_BITS:case this.UNPACK_ALIGNMENT:case this.UNPACK_COLORSPACE_CONVERSION_WEBGL:return this._gl.getParameteri(e);case this.IMPLEMENTATION_COLOR_READ_FORMAT:case this.IMPLEMENTATION_COLOR_READ_TYPE:return this._getParameterDirect(e);default:if(this._extensions.webgl_draw_buffers){let t=this._extensions.webgl_draw_buffers;switch(e){case t.DRAW_BUFFER0_WEBGL:case t.DRAW_BUFFER1_WEBGL:case t.DRAW_BUFFER2_WEBGL:case t.DRAW_BUFFER3_WEBGL:case t.DRAW_BUFFER4_WEBGL:case t.DRAW_BUFFER5_WEBGL:case t.DRAW_BUFFER6_WEBGL:case t.DRAW_BUFFER7_WEBGL:case t.DRAW_BUFFER8_WEBGL:case t.DRAW_BUFFER9_WEBGL:case t.DRAW_BUFFER10_WEBGL:case t.DRAW_BUFFER11_WEBGL:case t.DRAW_BUFFER12_WEBGL:case t.DRAW_BUFFER13_WEBGL:case t.DRAW_BUFFER14_WEBGL:case t.DRAW_BUFFER15_WEBGL:return t._buffersState.length===1&&t._buffersState[0]===this.BACK?this.BACK:this._getParameterDirect(e);case t.MAX_DRAW_BUFFERS_WEBGL:case t.MAX_COLOR_ATTACHMENTS_WEBGL:return this._getParameterDirect(e)}}return this._extensions.oes_standard_derivatives&&e===this._extensions.oes_standard_derivatives.FRAGMENT_SHADER_DERIVATIVE_HINT_OES||this._extensions.ext_texture_filter_anisotropic&&e===this._extensions.ext_texture_filter_anisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT?this._getParameterDirect(e):this._extensions.oes_vertex_array_object&&e===this._extensions.oes_vertex_array_object.VERTEX_ARRAY_BINDING_OES?this._extensions.oes_vertex_array_object._activeVertexArrayObject:(this.setError(this.INVALID_ENUM),null)}}destroy(){y(`destroy`)}};g(WebGLContextBase.prototype);export{WebGLContextBase};
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{WebGLBuffer as e}from"./webgl-buffer.js";var WebGLVertexArrayObjectAttribute=class{constructor(e,t){this._isPointer=!1,this._pointerBuffer=null,this._pointerOffset=0,this._pointerSize=0,this._pointerStride=0,this._pointerType=0,this._pointerNormal=!1,this._divisor=0,this._inputSize=4,this._inputStride=0,this._ctx=e,this._idx=t,this._pointerType=e.FLOAT,this._clear()}_clear(){this._isPointer=!1,this._pointerBuffer=null,this._pointerOffset=0,this._pointerSize=0,this._pointerStride=0,this._pointerType=this._ctx.FLOAT,this._pointerNormal=!1,this._divisor=0,this._inputSize=4,this._inputStride=0}},WebGLVertexArrayGlobalAttribute=class{constructor(e){this._idx=0,this._idx=e,this._data=new Float32Array([0,0,0,1])}},WebGLVertexArrayObjectState=class{constructor(e){this._elementArrayBufferBinding=null;let t=e.getParameter(e.MAX_VERTEX_ATTRIBS);this._attribs=Array(t);for(let n=0;n<t;++n)this._attribs[n]=new WebGLVertexArrayObjectAttribute(e,n);this._elementArrayBufferBinding=null}setElementArrayBuffer(t){if(t!==null&&!(t instanceof e))throw TypeError(`setElementArrayBuffer(WebGLBuffer?)`);let n=this._elementArrayBufferBinding;n!==t&&(n&&(--n._refCount,n._checkDelete()),t&&(t._refCount+=1),this._elementArrayBufferBinding=t)}cleanUp(){let e=this._elementArrayBufferBinding;e&&(--e._refCount,e._checkDelete(),this._elementArrayBufferBinding=null);for(let e=0;e<this._attribs.length;++e){let t=this._attribs[e];t._pointerBuffer&&(--t._pointerBuffer._refCount,t._pointerBuffer._checkDelete()),t._clear()}}releaseArrayBuffer(e){if(e)for(let t=0;t<this._attribs.length;++t){let n=this._attribs[t];n._pointerBuffer===e&&(--n._pointerBuffer._refCount,n._pointerBuffer._checkDelete(),n._clear())}}setVertexAttribPointer(e,t,n,r,i,a,o,s,c){let l=this._attribs[t];e!==l._pointerBuffer&&(l._pointerBuffer&&(--l._pointerBuffer._refCount,l._pointerBuffer._checkDelete()),e&&(e._refCount+=1),l._pointerBuffer=e),l._pointerSize=n,l._pointerOffset=r,l._pointerStride=i,l._pointerType=a,l._pointerNormal=o,l._inputStride=s,l._inputSize=c}},WebGLVertexArrayGlobalState=class{constructor(e){this._arrayBufferBinding=null;let t=e.getParameter(e.MAX_VERTEX_ATTRIBS);this._attribs=Array(t);for(let e=0;e<t;++e)this._attribs[e]=new WebGLVertexArrayGlobalAttribute(e);this._arrayBufferBinding=null}setArrayBuffer(t){if(t!==null&&!(t instanceof e))throw TypeError(`setArrayBuffer(WebGLBuffer?)`);let n=this._arrayBufferBinding;n!==t&&(n&&(--n._refCount,n._checkDelete()),t&&(t._refCount+=1),this._arrayBufferBinding=t)}};export{WebGLVertexArrayGlobalAttribute,WebGLVertexArrayGlobalState,WebGLVertexArrayObjectAttribute,WebGLVertexArrayObjectState};
1
+ import"./_virtual/_rolldown/runtime.js";import{WebGLBuffer as e}from"./webgl-buffer.js";var WebGLVertexArrayObjectAttribute=class{constructor(e,t){this._isPointer=!1,this._pointerBuffer=null,this._pointerOffset=0,this._pointerSize=0,this._pointerStride=0,this._pointerType=0,this._pointerNormal=!1,this._divisor=0,this._inputSize=4,this._inputStride=0,this._ctx=e,this._idx=t,this._pointerType=e.FLOAT,this._clear()}_clear(){this._isPointer=!1,this._pointerBuffer=null,this._pointerOffset=0,this._pointerSize=0,this._pointerStride=0,this._pointerType=this._ctx.FLOAT,this._pointerNormal=!1,this._divisor=0,this._inputSize=4,this._inputStride=0}},WebGLVertexArrayGlobalAttribute=class{constructor(e){this._idx=0,this._idx=e,this._data=new Float32Array([0,0,0,1])}},WebGLVertexArrayObjectState=class{constructor(e){this._elementArrayBufferBinding=null;let t=e.getParameter(e.MAX_VERTEX_ATTRIBS);this._attribs=Array.from({length:t});for(let n=0;n<t;++n)this._attribs[n]=new WebGLVertexArrayObjectAttribute(e,n);this._elementArrayBufferBinding=null}setElementArrayBuffer(t){if(t!==null&&!(t instanceof e))throw TypeError(`setElementArrayBuffer(WebGLBuffer?)`);let n=this._elementArrayBufferBinding;n!==t&&(n&&(--n._refCount,n._checkDelete()),t&&(t._refCount+=1),this._elementArrayBufferBinding=t)}cleanUp(){let e=this._elementArrayBufferBinding;e&&(--e._refCount,e._checkDelete(),this._elementArrayBufferBinding=null);for(let e=0;e<this._attribs.length;++e){let t=this._attribs[e];t._pointerBuffer&&(--t._pointerBuffer._refCount,t._pointerBuffer._checkDelete()),t._clear()}}releaseArrayBuffer(e){if(e)for(let t=0;t<this._attribs.length;++t){let n=this._attribs[t];n._pointerBuffer===e&&(--n._pointerBuffer._refCount,n._pointerBuffer._checkDelete(),n._clear())}}setVertexAttribPointer(e,t,n,r,i,a,o,s,c){let l=this._attribs[t];e!==l._pointerBuffer&&(l._pointerBuffer&&(--l._pointerBuffer._refCount,l._pointerBuffer._checkDelete()),e&&(e._refCount+=1),l._pointerBuffer=e),l._pointerSize=n,l._pointerOffset=r,l._pointerStride=i,l._pointerType=a,l._pointerNormal=o,l._inputStride=s,l._inputSize=c}},WebGLVertexArrayGlobalState=class{constructor(e){this._arrayBufferBinding=null;let t=e.getParameter(e.MAX_VERTEX_ATTRIBS);this._attribs=Array.from({length:t});for(let e=0;e<t;++e)this._attribs[e]=new WebGLVertexArrayGlobalAttribute(e);this._arrayBufferBinding=null}setArrayBuffer(t){if(t!==null&&!(t instanceof e))throw TypeError(`setArrayBuffer(WebGLBuffer?)`);let n=this._arrayBufferBinding;n!==t&&(n&&(--n._refCount,n._checkDelete()),t&&(t._refCount+=1),this._arrayBufferBinding=t)}};export{WebGLVertexArrayGlobalAttribute,WebGLVertexArrayGlobalState,WebGLVertexArrayObjectAttribute,WebGLVertexArrayObjectState};
@@ -1,6 +1,6 @@
1
1
  import GdkPixbuf from 'gi://GdkPixbuf?version=2.0';
2
2
  import { WebGLTexture } from '../webgl-texture.js';
3
- import { WebGLTextureUnit } from '../webgl-texture-unit.js';
3
+ import type { WebGLTextureUnit } from '../webgl-texture-unit.js';
4
4
  import type { TypedArray } from '../types/index.js';
5
5
  export interface TextureManagementMethods {
6
6
  activeTexture(texture?: GLenum): void;
@@ -1,5 +1,5 @@
1
1
  import { HTMLCanvasElement as BaseHTMLCanvasElement } from '@gjsify/dom-elements';
2
- import Gtk from 'gi://Gtk?version=4.0';
2
+ import type Gtk from 'gi://Gtk?version=4.0';
3
3
  import { WebGLRenderingContext as OurWebGLRenderingContext } from './webgl-rendering-context.js';
4
4
  import { WebGL2RenderingContext as OurWebGL2RenderingContext } from './webgl2-rendering-context.js';
5
5
  export declare class HTMLCanvasElement extends BaseHTMLCanvasElement {
@@ -23,13 +23,13 @@ export interface WebGLConstants {
23
23
  readonly FUNC_ADD: 0x8006;
24
24
  readonly BLEND_EQUATION: 0x8009;
25
25
  readonly BLEND_EQUATION_RGB: 0x8009;
26
- readonly BLEND_EQUATION_ALPHA: 0x883D;
27
- readonly FUNC_SUBTRACT: 0x800A;
28
- readonly FUNC_REVERSE_SUBTRACT: 0x800B;
29
- readonly BLEND_DST_RGB: 0x80C8;
30
- readonly BLEND_SRC_RGB: 0x80C9;
31
- readonly BLEND_DST_ALPHA: 0x80CA;
32
- readonly BLEND_SRC_ALPHA: 0x80CB;
26
+ readonly BLEND_EQUATION_ALPHA: 0x883d;
27
+ readonly FUNC_SUBTRACT: 0x800a;
28
+ readonly FUNC_REVERSE_SUBTRACT: 0x800b;
29
+ readonly BLEND_DST_RGB: 0x80c8;
30
+ readonly BLEND_SRC_RGB: 0x80c9;
31
+ readonly BLEND_DST_ALPHA: 0x80ca;
32
+ readonly BLEND_SRC_ALPHA: 0x80cb;
33
33
  readonly CONSTANT_COLOR: 0x8001;
34
34
  readonly ONE_MINUS_CONSTANT_COLOR: 0x8002;
35
35
  readonly CONSTANT_ALPHA: 0x8003;
@@ -39,24 +39,24 @@ export interface WebGLConstants {
39
39
  readonly ELEMENT_ARRAY_BUFFER: 0x8893;
40
40
  readonly ARRAY_BUFFER_BINDING: 0x8894;
41
41
  readonly ELEMENT_ARRAY_BUFFER_BINDING: 0x8895;
42
- readonly STREAM_DRAW: 0x88E0;
43
- readonly STATIC_DRAW: 0x88E4;
44
- readonly DYNAMIC_DRAW: 0x88E8;
42
+ readonly STREAM_DRAW: 0x88e0;
43
+ readonly STATIC_DRAW: 0x88e4;
44
+ readonly DYNAMIC_DRAW: 0x88e8;
45
45
  readonly BUFFER_SIZE: 0x8764;
46
46
  readonly BUFFER_USAGE: 0x8765;
47
47
  readonly CURRENT_VERTEX_ATTRIB: 0x8626;
48
48
  readonly FRONT: 0x0404;
49
49
  readonly BACK: 0x0405;
50
50
  readonly FRONT_AND_BACK: 0x0408;
51
- readonly CULL_FACE: 0x0B44;
52
- readonly BLEND: 0x0BE2;
53
- readonly DITHER: 0x0BD0;
54
- readonly STENCIL_TEST: 0x0B90;
55
- readonly DEPTH_TEST: 0x0B71;
56
- readonly SCISSOR_TEST: 0x0C11;
51
+ readonly CULL_FACE: 0x0b44;
52
+ readonly BLEND: 0x0be2;
53
+ readonly DITHER: 0x0bd0;
54
+ readonly STENCIL_TEST: 0x0b90;
55
+ readonly DEPTH_TEST: 0x0b71;
56
+ readonly SCISSOR_TEST: 0x0c11;
57
57
  readonly POLYGON_OFFSET_FILL: 0x8037;
58
- readonly SAMPLE_ALPHA_TO_COVERAGE: 0x809E;
59
- readonly SAMPLE_COVERAGE: 0x80A0;
58
+ readonly SAMPLE_ALPHA_TO_COVERAGE: 0x809e;
59
+ readonly SAMPLE_COVERAGE: 0x80a0;
60
60
  readonly NO_ERROR: 0;
61
61
  readonly INVALID_ENUM: 0x0500;
62
62
  readonly INVALID_VALUE: 0x0501;
@@ -64,53 +64,53 @@ export interface WebGLConstants {
64
64
  readonly OUT_OF_MEMORY: 0x0505;
65
65
  readonly CW: 0x0900;
66
66
  readonly CCW: 0x0901;
67
- readonly LINE_WIDTH: 0x0B21;
68
- readonly ALIASED_POINT_SIZE_RANGE: 0x846D;
69
- readonly ALIASED_LINE_WIDTH_RANGE: 0x846E;
70
- readonly CULL_FACE_MODE: 0x0B45;
71
- readonly FRONT_FACE: 0x0B46;
72
- readonly DEPTH_RANGE: 0x0B70;
73
- readonly DEPTH_WRITEMASK: 0x0B72;
74
- readonly DEPTH_CLEAR_VALUE: 0x0B73;
75
- readonly DEPTH_FUNC: 0x0B74;
76
- readonly STENCIL_CLEAR_VALUE: 0x0B91;
77
- readonly STENCIL_FUNC: 0x0B92;
78
- readonly STENCIL_FAIL: 0x0B94;
79
- readonly STENCIL_PASS_DEPTH_FAIL: 0x0B95;
80
- readonly STENCIL_PASS_DEPTH_PASS: 0x0B96;
81
- readonly STENCIL_REF: 0x0B97;
82
- readonly STENCIL_VALUE_MASK: 0x0B93;
83
- readonly STENCIL_WRITEMASK: 0x0B98;
67
+ readonly LINE_WIDTH: 0x0b21;
68
+ readonly ALIASED_POINT_SIZE_RANGE: 0x846d;
69
+ readonly ALIASED_LINE_WIDTH_RANGE: 0x846e;
70
+ readonly CULL_FACE_MODE: 0x0b45;
71
+ readonly FRONT_FACE: 0x0b46;
72
+ readonly DEPTH_RANGE: 0x0b70;
73
+ readonly DEPTH_WRITEMASK: 0x0b72;
74
+ readonly DEPTH_CLEAR_VALUE: 0x0b73;
75
+ readonly DEPTH_FUNC: 0x0b74;
76
+ readonly STENCIL_CLEAR_VALUE: 0x0b91;
77
+ readonly STENCIL_FUNC: 0x0b92;
78
+ readonly STENCIL_FAIL: 0x0b94;
79
+ readonly STENCIL_PASS_DEPTH_FAIL: 0x0b95;
80
+ readonly STENCIL_PASS_DEPTH_PASS: 0x0b96;
81
+ readonly STENCIL_REF: 0x0b97;
82
+ readonly STENCIL_VALUE_MASK: 0x0b93;
83
+ readonly STENCIL_WRITEMASK: 0x0b98;
84
84
  readonly STENCIL_BACK_FUNC: 0x8800;
85
85
  readonly STENCIL_BACK_FAIL: 0x8801;
86
86
  readonly STENCIL_BACK_PASS_DEPTH_FAIL: 0x8802;
87
87
  readonly STENCIL_BACK_PASS_DEPTH_PASS: 0x8803;
88
- readonly STENCIL_BACK_REF: 0x8CA3;
89
- readonly STENCIL_BACK_VALUE_MASK: 0x8CA4;
90
- readonly STENCIL_BACK_WRITEMASK: 0x8CA5;
91
- readonly VIEWPORT: 0x0BA2;
92
- readonly SCISSOR_BOX: 0x0C10;
93
- readonly COLOR_CLEAR_VALUE: 0x0C22;
94
- readonly COLOR_WRITEMASK: 0x0C23;
95
- readonly UNPACK_ALIGNMENT: 0x0CF5;
96
- readonly PACK_ALIGNMENT: 0x0D05;
97
- readonly MAX_TEXTURE_SIZE: 0x0D33;
98
- readonly MAX_VIEWPORT_DIMS: 0x0D3A;
99
- readonly SUBPIXEL_BITS: 0x0D50;
100
- readonly RED_BITS: 0x0D52;
101
- readonly GREEN_BITS: 0x0D53;
102
- readonly BLUE_BITS: 0x0D54;
103
- readonly ALPHA_BITS: 0x0D55;
104
- readonly DEPTH_BITS: 0x0D56;
105
- readonly STENCIL_BITS: 0x0D57;
106
- readonly POLYGON_OFFSET_UNITS: 0x2A00;
88
+ readonly STENCIL_BACK_REF: 0x8ca3;
89
+ readonly STENCIL_BACK_VALUE_MASK: 0x8ca4;
90
+ readonly STENCIL_BACK_WRITEMASK: 0x8ca5;
91
+ readonly VIEWPORT: 0x0ba2;
92
+ readonly SCISSOR_BOX: 0x0c10;
93
+ readonly COLOR_CLEAR_VALUE: 0x0c22;
94
+ readonly COLOR_WRITEMASK: 0x0c23;
95
+ readonly UNPACK_ALIGNMENT: 0x0cf5;
96
+ readonly PACK_ALIGNMENT: 0x0d05;
97
+ readonly MAX_TEXTURE_SIZE: 0x0d33;
98
+ readonly MAX_VIEWPORT_DIMS: 0x0d3a;
99
+ readonly SUBPIXEL_BITS: 0x0d50;
100
+ readonly RED_BITS: 0x0d52;
101
+ readonly GREEN_BITS: 0x0d53;
102
+ readonly BLUE_BITS: 0x0d54;
103
+ readonly ALPHA_BITS: 0x0d55;
104
+ readonly DEPTH_BITS: 0x0d56;
105
+ readonly STENCIL_BITS: 0x0d57;
106
+ readonly POLYGON_OFFSET_UNITS: 0x2a00;
107
107
  readonly POLYGON_OFFSET_FACTOR: 0x8038;
108
108
  readonly TEXTURE_BINDING_2D: 0x8069;
109
- readonly SAMPLE_BUFFERS: 0x80A8;
110
- readonly SAMPLES: 0x80A9;
111
- readonly SAMPLE_COVERAGE_VALUE: 0x80AA;
112
- readonly SAMPLE_COVERAGE_INVERT: 0x80AB;
113
- readonly COMPRESSED_TEXTURE_FORMATS: 0x86A3;
109
+ readonly SAMPLE_BUFFERS: 0x80a8;
110
+ readonly SAMPLES: 0x80a9;
111
+ readonly SAMPLE_COVERAGE_VALUE: 0x80aa;
112
+ readonly SAMPLE_COVERAGE_INVERT: 0x80ab;
113
+ readonly COMPRESSED_TEXTURE_FORMATS: 0x86a3;
114
114
  readonly DONT_CARE: 0x1100;
115
115
  readonly FASTEST: 0x1101;
116
116
  readonly NICEST: 0x1102;
@@ -127,28 +127,28 @@ export interface WebGLConstants {
127
127
  readonly RGB: 0x1907;
128
128
  readonly RGBA: 0x1908;
129
129
  readonly LUMINANCE: 0x1909;
130
- readonly LUMINANCE_ALPHA: 0x190A;
130
+ readonly LUMINANCE_ALPHA: 0x190a;
131
131
  readonly UNSIGNED_SHORT_4_4_4_4: 0x8033;
132
132
  readonly UNSIGNED_SHORT_5_5_5_1: 0x8034;
133
133
  readonly UNSIGNED_SHORT_5_6_5: 0x8363;
134
- readonly FRAGMENT_SHADER: 0x8B30;
135
- readonly VERTEX_SHADER: 0x8B31;
134
+ readonly FRAGMENT_SHADER: 0x8b30;
135
+ readonly VERTEX_SHADER: 0x8b31;
136
136
  readonly MAX_VERTEX_ATTRIBS: 0x8869;
137
- readonly MAX_VERTEX_UNIFORM_VECTORS: 0x8DFB;
138
- readonly MAX_VARYING_VECTORS: 0x8DFC;
139
- readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: 0x8B4D;
140
- readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: 0x8B4C;
137
+ readonly MAX_VERTEX_UNIFORM_VECTORS: 0x8dfb;
138
+ readonly MAX_VARYING_VECTORS: 0x8dfc;
139
+ readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: 0x8b4d;
140
+ readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: 0x8b4c;
141
141
  readonly MAX_TEXTURE_IMAGE_UNITS: 0x8872;
142
- readonly MAX_FRAGMENT_UNIFORM_VECTORS: 0x8DFD;
143
- readonly SHADER_TYPE: 0x8B4F;
144
- readonly DELETE_STATUS: 0x8B80;
145
- readonly LINK_STATUS: 0x8B82;
146
- readonly VALIDATE_STATUS: 0x8B83;
147
- readonly ATTACHED_SHADERS: 0x8B85;
148
- readonly ACTIVE_UNIFORMS: 0x8B86;
149
- readonly ACTIVE_ATTRIBUTES: 0x8B89;
150
- readonly SHADING_LANGUAGE_VERSION: 0x8B8C;
151
- readonly CURRENT_PROGRAM: 0x8B8D;
142
+ readonly MAX_FRAGMENT_UNIFORM_VECTORS: 0x8dfd;
143
+ readonly SHADER_TYPE: 0x8b4f;
144
+ readonly DELETE_STATUS: 0x8b80;
145
+ readonly LINK_STATUS: 0x8b82;
146
+ readonly VALIDATE_STATUS: 0x8b83;
147
+ readonly ATTACHED_SHADERS: 0x8b85;
148
+ readonly ACTIVE_UNIFORMS: 0x8b86;
149
+ readonly ACTIVE_ATTRIBUTES: 0x8b89;
150
+ readonly SHADING_LANGUAGE_VERSION: 0x8b8c;
151
+ readonly CURRENT_PROGRAM: 0x8b8d;
152
152
  readonly NEVER: 0x0200;
153
153
  readonly LESS: 0x0201;
154
154
  readonly EQUAL: 0x0202;
@@ -157,16 +157,16 @@ export interface WebGLConstants {
157
157
  readonly NOTEQUAL: 0x0205;
158
158
  readonly GEQUAL: 0x0206;
159
159
  readonly ALWAYS: 0x0207;
160
- readonly KEEP: 0x1E00;
161
- readonly REPLACE: 0x1E01;
162
- readonly INCR: 0x1E02;
163
- readonly DECR: 0x1E03;
164
- readonly INVERT: 0x150A;
160
+ readonly KEEP: 0x1e00;
161
+ readonly REPLACE: 0x1e01;
162
+ readonly INCR: 0x1e02;
163
+ readonly DECR: 0x1e03;
164
+ readonly INVERT: 0x150a;
165
165
  readonly INCR_WRAP: 0x8507;
166
166
  readonly DECR_WRAP: 0x8508;
167
- readonly VENDOR: 0x1F00;
168
- readonly RENDERER: 0x1F01;
169
- readonly VERSION: 0x1F02;
167
+ readonly VENDOR: 0x1f00;
168
+ readonly RENDERER: 0x1f01;
169
+ readonly VERSION: 0x1f02;
170
170
  readonly NEAREST: 0x2600;
171
171
  readonly LINEAR: 0x2601;
172
172
  readonly NEAREST_MIPMAP_NEAREST: 0x2700;
@@ -177,7 +177,7 @@ export interface WebGLConstants {
177
177
  readonly TEXTURE_MIN_FILTER: 0x2801;
178
178
  readonly TEXTURE_WRAP_S: 0x2802;
179
179
  readonly TEXTURE_WRAP_T: 0x2803;
180
- readonly TEXTURE_2D: 0x0DE1;
180
+ readonly TEXTURE_2D: 0x0de1;
181
181
  readonly TEXTURE: 0x1702;
182
182
  readonly TEXTURE_CUBE_MAP: 0x8513;
183
183
  readonly TEXTURE_BINDING_CUBE_MAP: 0x8514;
@@ -186,109 +186,109 @@ export interface WebGLConstants {
186
186
  readonly TEXTURE_CUBE_MAP_POSITIVE_Y: 0x8517;
187
187
  readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: 0x8518;
188
188
  readonly TEXTURE_CUBE_MAP_POSITIVE_Z: 0x8519;
189
- readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: 0x851A;
190
- readonly MAX_CUBE_MAP_TEXTURE_SIZE: 0x851C;
191
- readonly TEXTURE0: 0x84C0;
192
- readonly TEXTURE1: 0x84C1;
193
- readonly TEXTURE2: 0x84C2;
194
- readonly TEXTURE3: 0x84C3;
195
- readonly TEXTURE4: 0x84C4;
196
- readonly TEXTURE5: 0x84C5;
197
- readonly TEXTURE6: 0x84C6;
198
- readonly TEXTURE7: 0x84C7;
199
- readonly TEXTURE8: 0x84C8;
200
- readonly TEXTURE9: 0x84C9;
201
- readonly TEXTURE10: 0x84CA;
202
- readonly TEXTURE11: 0x84CB;
203
- readonly TEXTURE12: 0x84CC;
204
- readonly TEXTURE13: 0x84CD;
205
- readonly TEXTURE14: 0x84CE;
206
- readonly TEXTURE15: 0x84CF;
207
- readonly TEXTURE16: 0x84D0;
208
- readonly TEXTURE17: 0x84D1;
209
- readonly TEXTURE18: 0x84D2;
210
- readonly TEXTURE19: 0x84D3;
211
- readonly TEXTURE20: 0x84D4;
212
- readonly TEXTURE21: 0x84D5;
213
- readonly TEXTURE22: 0x84D6;
214
- readonly TEXTURE23: 0x84D7;
215
- readonly TEXTURE24: 0x84D8;
216
- readonly TEXTURE25: 0x84D9;
217
- readonly TEXTURE26: 0x84DA;
218
- readonly TEXTURE27: 0x84DB;
219
- readonly TEXTURE28: 0x84DC;
220
- readonly TEXTURE29: 0x84DD;
221
- readonly TEXTURE30: 0x84DE;
222
- readonly TEXTURE31: 0x84DF;
223
- readonly ACTIVE_TEXTURE: 0x84E0;
189
+ readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: 0x851a;
190
+ readonly MAX_CUBE_MAP_TEXTURE_SIZE: 0x851c;
191
+ readonly TEXTURE0: 0x84c0;
192
+ readonly TEXTURE1: 0x84c1;
193
+ readonly TEXTURE2: 0x84c2;
194
+ readonly TEXTURE3: 0x84c3;
195
+ readonly TEXTURE4: 0x84c4;
196
+ readonly TEXTURE5: 0x84c5;
197
+ readonly TEXTURE6: 0x84c6;
198
+ readonly TEXTURE7: 0x84c7;
199
+ readonly TEXTURE8: 0x84c8;
200
+ readonly TEXTURE9: 0x84c9;
201
+ readonly TEXTURE10: 0x84ca;
202
+ readonly TEXTURE11: 0x84cb;
203
+ readonly TEXTURE12: 0x84cc;
204
+ readonly TEXTURE13: 0x84cd;
205
+ readonly TEXTURE14: 0x84ce;
206
+ readonly TEXTURE15: 0x84cf;
207
+ readonly TEXTURE16: 0x84d0;
208
+ readonly TEXTURE17: 0x84d1;
209
+ readonly TEXTURE18: 0x84d2;
210
+ readonly TEXTURE19: 0x84d3;
211
+ readonly TEXTURE20: 0x84d4;
212
+ readonly TEXTURE21: 0x84d5;
213
+ readonly TEXTURE22: 0x84d6;
214
+ readonly TEXTURE23: 0x84d7;
215
+ readonly TEXTURE24: 0x84d8;
216
+ readonly TEXTURE25: 0x84d9;
217
+ readonly TEXTURE26: 0x84da;
218
+ readonly TEXTURE27: 0x84db;
219
+ readonly TEXTURE28: 0x84dc;
220
+ readonly TEXTURE29: 0x84dd;
221
+ readonly TEXTURE30: 0x84de;
222
+ readonly TEXTURE31: 0x84df;
223
+ readonly ACTIVE_TEXTURE: 0x84e0;
224
224
  readonly REPEAT: 0x2901;
225
- readonly CLAMP_TO_EDGE: 0x812F;
225
+ readonly CLAMP_TO_EDGE: 0x812f;
226
226
  readonly MIRRORED_REPEAT: 0x8370;
227
- readonly FLOAT_VEC2: 0x8B50;
228
- readonly FLOAT_VEC3: 0x8B51;
229
- readonly FLOAT_VEC4: 0x8B52;
230
- readonly INT_VEC2: 0x8B53;
231
- readonly INT_VEC3: 0x8B54;
232
- readonly INT_VEC4: 0x8B55;
233
- readonly BOOL: 0x8B56;
234
- readonly BOOL_VEC2: 0x8B57;
235
- readonly BOOL_VEC3: 0x8B58;
236
- readonly BOOL_VEC4: 0x8B59;
237
- readonly FLOAT_MAT2: 0x8B5A;
238
- readonly FLOAT_MAT3: 0x8B5B;
239
- readonly FLOAT_MAT4: 0x8B5C;
240
- readonly SAMPLER_2D: 0x8B5E;
241
- readonly SAMPLER_CUBE: 0x8B60;
227
+ readonly FLOAT_VEC2: 0x8b50;
228
+ readonly FLOAT_VEC3: 0x8b51;
229
+ readonly FLOAT_VEC4: 0x8b52;
230
+ readonly INT_VEC2: 0x8b53;
231
+ readonly INT_VEC3: 0x8b54;
232
+ readonly INT_VEC4: 0x8b55;
233
+ readonly BOOL: 0x8b56;
234
+ readonly BOOL_VEC2: 0x8b57;
235
+ readonly BOOL_VEC3: 0x8b58;
236
+ readonly BOOL_VEC4: 0x8b59;
237
+ readonly FLOAT_MAT2: 0x8b5a;
238
+ readonly FLOAT_MAT3: 0x8b5b;
239
+ readonly FLOAT_MAT4: 0x8b5c;
240
+ readonly SAMPLER_2D: 0x8b5e;
241
+ readonly SAMPLER_CUBE: 0x8b60;
242
242
  readonly VERTEX_ATTRIB_ARRAY_ENABLED: 0x8622;
243
243
  readonly VERTEX_ATTRIB_ARRAY_SIZE: 0x8623;
244
244
  readonly VERTEX_ATTRIB_ARRAY_STRIDE: 0x8624;
245
245
  readonly VERTEX_ATTRIB_ARRAY_TYPE: 0x8625;
246
- readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: 0x886A;
246
+ readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: 0x886a;
247
247
  readonly VERTEX_ATTRIB_ARRAY_POINTER: 0x8645;
248
- readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 0x889F;
249
- readonly IMPLEMENTATION_COLOR_READ_TYPE: 0x8B9A;
250
- readonly IMPLEMENTATION_COLOR_READ_FORMAT: 0x8B9B;
251
- readonly COMPILE_STATUS: 0x8B81;
252
- readonly LOW_FLOAT: 0x8DF0;
253
- readonly MEDIUM_FLOAT: 0x8DF1;
254
- readonly HIGH_FLOAT: 0x8DF2;
255
- readonly LOW_INT: 0x8DF3;
256
- readonly MEDIUM_INT: 0x8DF4;
257
- readonly HIGH_INT: 0x8DF5;
258
- readonly FRAMEBUFFER: 0x8D40;
259
- readonly RENDERBUFFER: 0x8D41;
248
+ readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 0x889f;
249
+ readonly IMPLEMENTATION_COLOR_READ_TYPE: 0x8b9a;
250
+ readonly IMPLEMENTATION_COLOR_READ_FORMAT: 0x8b9b;
251
+ readonly COMPILE_STATUS: 0x8b81;
252
+ readonly LOW_FLOAT: 0x8df0;
253
+ readonly MEDIUM_FLOAT: 0x8df1;
254
+ readonly HIGH_FLOAT: 0x8df2;
255
+ readonly LOW_INT: 0x8df3;
256
+ readonly MEDIUM_INT: 0x8df4;
257
+ readonly HIGH_INT: 0x8df5;
258
+ readonly FRAMEBUFFER: 0x8d40;
259
+ readonly RENDERBUFFER: 0x8d41;
260
260
  readonly RGBA4: 0x8056;
261
261
  readonly RGB5_A1: 0x8057;
262
- readonly RGB565: 0x8D62;
263
- readonly DEPTH_COMPONENT16: 0x81A5;
264
- readonly STENCIL_INDEX8: 0x8D48;
265
- readonly DEPTH_STENCIL: 0x84F9;
266
- readonly RENDERBUFFER_WIDTH: 0x8D42;
267
- readonly RENDERBUFFER_HEIGHT: 0x8D43;
268
- readonly RENDERBUFFER_INTERNAL_FORMAT: 0x8D44;
269
- readonly RENDERBUFFER_RED_SIZE: 0x8D50;
270
- readonly RENDERBUFFER_GREEN_SIZE: 0x8D51;
271
- readonly RENDERBUFFER_BLUE_SIZE: 0x8D52;
272
- readonly RENDERBUFFER_ALPHA_SIZE: 0x8D53;
273
- readonly RENDERBUFFER_DEPTH_SIZE: 0x8D54;
274
- readonly RENDERBUFFER_STENCIL_SIZE: 0x8D55;
275
- readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 0x8CD0;
276
- readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 0x8CD1;
277
- readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 0x8CD2;
278
- readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 0x8CD3;
279
- readonly COLOR_ATTACHMENT0: 0x8CE0;
280
- readonly DEPTH_ATTACHMENT: 0x8D00;
281
- readonly STENCIL_ATTACHMENT: 0x8D20;
282
- readonly DEPTH_STENCIL_ATTACHMENT: 0x821A;
262
+ readonly RGB565: 0x8d62;
263
+ readonly DEPTH_COMPONENT16: 0x81a5;
264
+ readonly STENCIL_INDEX8: 0x8d48;
265
+ readonly DEPTH_STENCIL: 0x84f9;
266
+ readonly RENDERBUFFER_WIDTH: 0x8d42;
267
+ readonly RENDERBUFFER_HEIGHT: 0x8d43;
268
+ readonly RENDERBUFFER_INTERNAL_FORMAT: 0x8d44;
269
+ readonly RENDERBUFFER_RED_SIZE: 0x8d50;
270
+ readonly RENDERBUFFER_GREEN_SIZE: 0x8d51;
271
+ readonly RENDERBUFFER_BLUE_SIZE: 0x8d52;
272
+ readonly RENDERBUFFER_ALPHA_SIZE: 0x8d53;
273
+ readonly RENDERBUFFER_DEPTH_SIZE: 0x8d54;
274
+ readonly RENDERBUFFER_STENCIL_SIZE: 0x8d55;
275
+ readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 0x8cd0;
276
+ readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 0x8cd1;
277
+ readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 0x8cd2;
278
+ readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 0x8cd3;
279
+ readonly COLOR_ATTACHMENT0: 0x8ce0;
280
+ readonly DEPTH_ATTACHMENT: 0x8d00;
281
+ readonly STENCIL_ATTACHMENT: 0x8d20;
282
+ readonly DEPTH_STENCIL_ATTACHMENT: 0x821a;
283
283
  readonly NONE: 0;
284
- readonly FRAMEBUFFER_COMPLETE: 0x8CD5;
285
- readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 0x8CD6;
286
- readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 0x8CD7;
287
- readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 0x8CD9;
288
- readonly FRAMEBUFFER_UNSUPPORTED: 0x8CDD;
289
- readonly FRAMEBUFFER_BINDING: 0x8CA6;
290
- readonly RENDERBUFFER_BINDING: 0x8CA7;
291
- readonly MAX_RENDERBUFFER_SIZE: 0x84E8;
284
+ readonly FRAMEBUFFER_COMPLETE: 0x8cd5;
285
+ readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 0x8cd6;
286
+ readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 0x8cd7;
287
+ readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 0x8cd9;
288
+ readonly FRAMEBUFFER_UNSUPPORTED: 0x8cdd;
289
+ readonly FRAMEBUFFER_BINDING: 0x8ca6;
290
+ readonly RENDERBUFFER_BINDING: 0x8ca7;
291
+ readonly MAX_RENDERBUFFER_SIZE: 0x84e8;
292
292
  readonly INVALID_FRAMEBUFFER_OPERATION: 0x0506;
293
293
  readonly UNPACK_FLIP_Y_WEBGL: 0x9240;
294
294
  readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: 0x9241;
@@ -1,7 +1,7 @@
1
1
  import { WebGLUniformLocation } from './webgl-uniform-location.js';
2
- import { WebGLProgram } from './webgl-program.js';
2
+ import type { WebGLProgram } from './webgl-program.js';
3
3
  import GLib from '@girs/glib-2.0';
4
- import { HTMLImageElement } from "@gjsify/dom-elements";
4
+ import type { HTMLImageElement } from '@gjsify/dom-elements';
5
5
  import type { WebGLContextBase } from './webgl-context-base.js';
6
6
  import type { TypedArray } from './types/index.js';
7
7
  export declare function bindPublics(props: Array<keyof WebGLContextBase>, wrapper: WebGLContextBase, privateInstance: WebGLContextBase, privateMethods: string[]): void;
@@ -1,5 +1,5 @@
1
1
  import GObject from 'gi://GObject';
2
- import Gdk from 'gi://Gdk?version=4.0';
2
+ import type Gdk from 'gi://Gdk?version=4.0';
3
3
  import GLib from 'gi://GLib?version=2.0';
4
4
  import Gtk from 'gi://Gtk?version=4.0';
5
5
  import { HTMLCanvasElement as OurHTMLCanvasElement } from './html-canvas-element.js';
@@ -31,6 +31,8 @@ export declare const WebGLBridge: {
31
31
  _renderTag: number | null;
32
32
  _tickCallbackId: number | null;
33
33
  _frameCallback: FrameRequestCallback | null;
34
+ _frameCallbackId: number;
35
+ _nextFrameId: number;
34
36
  _timeOrigin: number;
35
37
  /** The HTMLCanvasElement wrapping this GLArea. Available after the first render. */
36
38
  get canvas(): globalThis.HTMLCanvasElement | null;
@@ -56,9 +58,29 @@ export declare const WebGLBridge: {
56
58
  * Backed by a persistent GTK frame clock tick callback (vsync-synced) + a persistent GLArea
57
59
  * render signal handler. Both are installed once at construction / first render respectively,
58
60
  * eliminating per-frame GLib.Source allocation and GObject signal connect/disconnect overhead.
59
- * Returns 0 (handle — cancel via cancelAnimationFrame clears the pending callback).
61
+ *
62
+ * Returns a monotonically-increasing handle; pass it to `cancelAnimationFrame(id)` to cancel
63
+ * the specific pending callback. A second `requestAnimationFrame` call before the first has
64
+ * fired replaces the pending callback (single-slot model — matching the existing rAF
65
+ * convention of "queue 1 callback per frame, the latest wins"); the older handle becomes
66
+ * stale and a `cancelAnimationFrame` with that handle is a no-op.
60
67
  */
61
68
  requestAnimationFrame(cb: FrameRequestCallback): number;
69
+ /**
70
+ * Cancels a previously-scheduled animation frame callback, matching the browser
71
+ * `cancelAnimationFrame` API. Only clears the pending callback when `id` matches
72
+ * the handle returned by the most recent `requestAnimationFrame` call — a stale
73
+ * handle (from a callback that already fired, or was replaced by a later
74
+ * `requestAnimationFrame`) is a no-op.
75
+ *
76
+ * Per-ID matching is load-bearing: without it any consumer that calls
77
+ * `cancelAnimationFrame` (e.g. Excalibur's `Engine.stop()`, called from a
78
+ * transient parent `unmap` in a responsive layout) would clear the loop's
79
+ * latest pending callback and freeze rendering until the next manual
80
+ * `requestAnimationFrame`. With it, the cancel only fires for the handle
81
+ * the caller actually owns.
82
+ */
83
+ cancelAnimationFrame(id: number): void;
62
84
  /**
63
85
  * Sets browser globals (`requestAnimationFrame`, `performance`) so that
64
86
  * browser-targeted code (e.g. Three.js) works unchanged on GJS.
@@ -491,6 +513,8 @@ export declare const WebGLBridge: {
491
513
  _renderTag: number | null;
492
514
  _tickCallbackId: number | null;
493
515
  _frameCallback: FrameRequestCallback | null;
516
+ _frameCallbackId: number;
517
+ _nextFrameId: number;
494
518
  _timeOrigin: number;
495
519
  /** The HTMLCanvasElement wrapping this GLArea. Available after the first render. */
496
520
  get canvas(): globalThis.HTMLCanvasElement | null;
@@ -516,9 +540,29 @@ export declare const WebGLBridge: {
516
540
  * Backed by a persistent GTK frame clock tick callback (vsync-synced) + a persistent GLArea
517
541
  * render signal handler. Both are installed once at construction / first render respectively,
518
542
  * eliminating per-frame GLib.Source allocation and GObject signal connect/disconnect overhead.
519
- * Returns 0 (handle — cancel via cancelAnimationFrame clears the pending callback).
543
+ *
544
+ * Returns a monotonically-increasing handle; pass it to `cancelAnimationFrame(id)` to cancel
545
+ * the specific pending callback. A second `requestAnimationFrame` call before the first has
546
+ * fired replaces the pending callback (single-slot model — matching the existing rAF
547
+ * convention of "queue 1 callback per frame, the latest wins"); the older handle becomes
548
+ * stale and a `cancelAnimationFrame` with that handle is a no-op.
520
549
  */
521
550
  requestAnimationFrame(cb: FrameRequestCallback): number;
551
+ /**
552
+ * Cancels a previously-scheduled animation frame callback, matching the browser
553
+ * `cancelAnimationFrame` API. Only clears the pending callback when `id` matches
554
+ * the handle returned by the most recent `requestAnimationFrame` call — a stale
555
+ * handle (from a callback that already fired, or was replaced by a later
556
+ * `requestAnimationFrame`) is a no-op.
557
+ *
558
+ * Per-ID matching is load-bearing: without it any consumer that calls
559
+ * `cancelAnimationFrame` (e.g. Excalibur's `Engine.stop()`, called from a
560
+ * transient parent `unmap` in a responsive layout) would clear the loop's
561
+ * latest pending callback and freeze rendering until the next manual
562
+ * `requestAnimationFrame`. With it, the cancel only fires for the handle
563
+ * the caller actually owns.
564
+ */
565
+ cancelAnimationFrame(id: number): void;
522
566
  /**
523
567
  * Sets browser globals (`requestAnimationFrame`, `performance`) so that
524
568
  * browser-targeted code (e.g. Three.js) works unchanged on GJS.
@@ -951,6 +995,8 @@ export declare const WebGLBridge: {
951
995
  _renderTag: number | null;
952
996
  _tickCallbackId: number | null;
953
997
  _frameCallback: FrameRequestCallback | null;
998
+ _frameCallbackId: number;
999
+ _nextFrameId: number;
954
1000
  _timeOrigin: number;
955
1001
  /** The HTMLCanvasElement wrapping this GLArea. Available after the first render. */
956
1002
  get canvas(): globalThis.HTMLCanvasElement | null;
@@ -976,9 +1022,29 @@ export declare const WebGLBridge: {
976
1022
  * Backed by a persistent GTK frame clock tick callback (vsync-synced) + a persistent GLArea
977
1023
  * render signal handler. Both are installed once at construction / first render respectively,
978
1024
  * eliminating per-frame GLib.Source allocation and GObject signal connect/disconnect overhead.
979
- * Returns 0 (handle — cancel via cancelAnimationFrame clears the pending callback).
1025
+ *
1026
+ * Returns a monotonically-increasing handle; pass it to `cancelAnimationFrame(id)` to cancel
1027
+ * the specific pending callback. A second `requestAnimationFrame` call before the first has
1028
+ * fired replaces the pending callback (single-slot model — matching the existing rAF
1029
+ * convention of "queue 1 callback per frame, the latest wins"); the older handle becomes
1030
+ * stale and a `cancelAnimationFrame` with that handle is a no-op.
980
1031
  */
981
1032
  requestAnimationFrame(cb: FrameRequestCallback): number;
1033
+ /**
1034
+ * Cancels a previously-scheduled animation frame callback, matching the browser
1035
+ * `cancelAnimationFrame` API. Only clears the pending callback when `id` matches
1036
+ * the handle returned by the most recent `requestAnimationFrame` call — a stale
1037
+ * handle (from a callback that already fired, or was replaced by a later
1038
+ * `requestAnimationFrame`) is a no-op.
1039
+ *
1040
+ * Per-ID matching is load-bearing: without it any consumer that calls
1041
+ * `cancelAnimationFrame` (e.g. Excalibur's `Engine.stop()`, called from a
1042
+ * transient parent `unmap` in a responsive layout) would clear the loop's
1043
+ * latest pending callback and freeze rendering until the next manual
1044
+ * `requestAnimationFrame`. With it, the cancel only fires for the handle
1045
+ * the caller actually owns.
1046
+ */
1047
+ cancelAnimationFrame(id: number): void;
982
1048
  /**
983
1049
  * Sets browser globals (`requestAnimationFrame`, `performance`) so that
984
1050
  * browser-targeted code (e.g. Three.js) works unchanged on GJS.
@@ -1411,6 +1477,8 @@ export declare const WebGLBridge: {
1411
1477
  _renderTag: number | null;
1412
1478
  _tickCallbackId: number | null;
1413
1479
  _frameCallback: FrameRequestCallback | null;
1480
+ _frameCallbackId: number;
1481
+ _nextFrameId: number;
1414
1482
  _timeOrigin: number;
1415
1483
  /** The HTMLCanvasElement wrapping this GLArea. Available after the first render. */
1416
1484
  get canvas(): globalThis.HTMLCanvasElement | null;
@@ -1436,9 +1504,29 @@ export declare const WebGLBridge: {
1436
1504
  * Backed by a persistent GTK frame clock tick callback (vsync-synced) + a persistent GLArea
1437
1505
  * render signal handler. Both are installed once at construction / first render respectively,
1438
1506
  * eliminating per-frame GLib.Source allocation and GObject signal connect/disconnect overhead.
1439
- * Returns 0 (handle — cancel via cancelAnimationFrame clears the pending callback).
1507
+ *
1508
+ * Returns a monotonically-increasing handle; pass it to `cancelAnimationFrame(id)` to cancel
1509
+ * the specific pending callback. A second `requestAnimationFrame` call before the first has
1510
+ * fired replaces the pending callback (single-slot model — matching the existing rAF
1511
+ * convention of "queue 1 callback per frame, the latest wins"); the older handle becomes
1512
+ * stale and a `cancelAnimationFrame` with that handle is a no-op.
1440
1513
  */
1441
1514
  requestAnimationFrame(cb: FrameRequestCallback): number;
1515
+ /**
1516
+ * Cancels a previously-scheduled animation frame callback, matching the browser
1517
+ * `cancelAnimationFrame` API. Only clears the pending callback when `id` matches
1518
+ * the handle returned by the most recent `requestAnimationFrame` call — a stale
1519
+ * handle (from a callback that already fired, or was replaced by a later
1520
+ * `requestAnimationFrame`) is a no-op.
1521
+ *
1522
+ * Per-ID matching is load-bearing: without it any consumer that calls
1523
+ * `cancelAnimationFrame` (e.g. Excalibur's `Engine.stop()`, called from a
1524
+ * transient parent `unmap` in a responsive layout) would clear the loop's
1525
+ * latest pending callback and freeze rendering until the next manual
1526
+ * `requestAnimationFrame`. With it, the cancel only fires for the handle
1527
+ * the caller actually owns.
1528
+ */
1529
+ cancelAnimationFrame(id: number): void;
1442
1530
  /**
1443
1531
  * Sets browser globals (`requestAnimationFrame`, `performance`) so that
1444
1532
  * browser-targeted code (e.g. Three.js) works unchanged on GJS.
@@ -1871,6 +1959,8 @@ export declare const WebGLBridge: {
1871
1959
  _renderTag: number | null;
1872
1960
  _tickCallbackId: number | null;
1873
1961
  _frameCallback: FrameRequestCallback | null;
1962
+ _frameCallbackId: number;
1963
+ _nextFrameId: number;
1874
1964
  _timeOrigin: number;
1875
1965
  /** The HTMLCanvasElement wrapping this GLArea. Available after the first render. */
1876
1966
  get canvas(): globalThis.HTMLCanvasElement | null;
@@ -1896,9 +1986,29 @@ export declare const WebGLBridge: {
1896
1986
  * Backed by a persistent GTK frame clock tick callback (vsync-synced) + a persistent GLArea
1897
1987
  * render signal handler. Both are installed once at construction / first render respectively,
1898
1988
  * eliminating per-frame GLib.Source allocation and GObject signal connect/disconnect overhead.
1899
- * Returns 0 (handle — cancel via cancelAnimationFrame clears the pending callback).
1989
+ *
1990
+ * Returns a monotonically-increasing handle; pass it to `cancelAnimationFrame(id)` to cancel
1991
+ * the specific pending callback. A second `requestAnimationFrame` call before the first has
1992
+ * fired replaces the pending callback (single-slot model — matching the existing rAF
1993
+ * convention of "queue 1 callback per frame, the latest wins"); the older handle becomes
1994
+ * stale and a `cancelAnimationFrame` with that handle is a no-op.
1900
1995
  */
1901
1996
  requestAnimationFrame(cb: FrameRequestCallback): number;
1997
+ /**
1998
+ * Cancels a previously-scheduled animation frame callback, matching the browser
1999
+ * `cancelAnimationFrame` API. Only clears the pending callback when `id` matches
2000
+ * the handle returned by the most recent `requestAnimationFrame` call — a stale
2001
+ * handle (from a callback that already fired, or was replaced by a later
2002
+ * `requestAnimationFrame`) is a no-op.
2003
+ *
2004
+ * Per-ID matching is load-bearing: without it any consumer that calls
2005
+ * `cancelAnimationFrame` (e.g. Excalibur's `Engine.stop()`, called from a
2006
+ * transient parent `unmap` in a responsive layout) would clear the loop's
2007
+ * latest pending callback and freeze rendering until the next manual
2008
+ * `requestAnimationFrame`. With it, the cancel only fires for the handle
2009
+ * the caller actually owns.
2010
+ */
2011
+ cancelAnimationFrame(id: number): void;
1902
2012
  /**
1903
2013
  * Sets browser globals (`requestAnimationFrame`, `performance`) so that
1904
2014
  * browser-targeted code (e.g. Three.js) works unchanged on GJS.
@@ -2331,6 +2441,8 @@ export declare const WebGLBridge: {
2331
2441
  _renderTag: number | null;
2332
2442
  _tickCallbackId: number | null;
2333
2443
  _frameCallback: FrameRequestCallback | null;
2444
+ _frameCallbackId: number;
2445
+ _nextFrameId: number;
2334
2446
  _timeOrigin: number;
2335
2447
  /** The HTMLCanvasElement wrapping this GLArea. Available after the first render. */
2336
2448
  get canvas(): globalThis.HTMLCanvasElement | null;
@@ -2356,9 +2468,29 @@ export declare const WebGLBridge: {
2356
2468
  * Backed by a persistent GTK frame clock tick callback (vsync-synced) + a persistent GLArea
2357
2469
  * render signal handler. Both are installed once at construction / first render respectively,
2358
2470
  * eliminating per-frame GLib.Source allocation and GObject signal connect/disconnect overhead.
2359
- * Returns 0 (handle — cancel via cancelAnimationFrame clears the pending callback).
2471
+ *
2472
+ * Returns a monotonically-increasing handle; pass it to `cancelAnimationFrame(id)` to cancel
2473
+ * the specific pending callback. A second `requestAnimationFrame` call before the first has
2474
+ * fired replaces the pending callback (single-slot model — matching the existing rAF
2475
+ * convention of "queue 1 callback per frame, the latest wins"); the older handle becomes
2476
+ * stale and a `cancelAnimationFrame` with that handle is a no-op.
2360
2477
  */
2361
2478
  requestAnimationFrame(cb: FrameRequestCallback): number;
2479
+ /**
2480
+ * Cancels a previously-scheduled animation frame callback, matching the browser
2481
+ * `cancelAnimationFrame` API. Only clears the pending callback when `id` matches
2482
+ * the handle returned by the most recent `requestAnimationFrame` call — a stale
2483
+ * handle (from a callback that already fired, or was replaced by a later
2484
+ * `requestAnimationFrame`) is a no-op.
2485
+ *
2486
+ * Per-ID matching is load-bearing: without it any consumer that calls
2487
+ * `cancelAnimationFrame` (e.g. Excalibur's `Engine.stop()`, called from a
2488
+ * transient parent `unmap` in a responsive layout) would clear the loop's
2489
+ * latest pending callback and freeze rendering until the next manual
2490
+ * `requestAnimationFrame`. With it, the cancel only fires for the handle
2491
+ * the caller actually owns.
2492
+ */
2493
+ cancelAnimationFrame(id: number): void;
2362
2494
  /**
2363
2495
  * Sets browser globals (`requestAnimationFrame`, `performance`) so that
2364
2496
  * browser-targeted code (e.g. Three.js) works unchanged on GJS.
@@ -1,14 +1,14 @@
1
1
  import '@girs/gdkpixbuf-2.0';
2
2
  import Gwebgl from '@girs/gwebgl-0.1';
3
3
  import { WebGLContextAttributes } from './webgl-context-attributes.js';
4
- import { HTMLCanvasElement } from './html-canvas-element.js';
5
- import { WebGLBuffer } from './webgl-buffer.js';
6
- import { WebGLDrawingBufferWrapper } from './webgl-drawing-buffer-wrapper.js';
7
- import { WebGLFramebuffer } from './webgl-framebuffer.js';
8
- import { WebGLProgram } from './webgl-program.js';
9
- import { WebGLRenderbuffer } from './webgl-renderbuffer.js';
10
- import { WebGLShader } from './webgl-shader.js';
11
- import { WebGLTexture } from './webgl-texture.js';
4
+ import type { HTMLCanvasElement } from './html-canvas-element.js';
5
+ import type { WebGLBuffer } from './webgl-buffer.js';
6
+ import type { WebGLDrawingBufferWrapper } from './webgl-drawing-buffer-wrapper.js';
7
+ import type { WebGLFramebuffer } from './webgl-framebuffer.js';
8
+ import type { WebGLProgram } from './webgl-program.js';
9
+ import type { WebGLRenderbuffer } from './webgl-renderbuffer.js';
10
+ import type { WebGLShader } from './webgl-shader.js';
11
+ import type { WebGLTexture } from './webgl-texture.js';
12
12
  import { WebGLTextureUnit } from './webgl-texture-unit.js';
13
13
  import { WebGLVertexArrayObjectState, WebGLVertexArrayGlobalState } from './webgl-vertex-attribute.js';
14
14
  import type { WebGLConstants } from './types/index.js';
@@ -1,5 +1,5 @@
1
1
  import { Linkable } from './linkable.js';
2
- import { WebGLActiveInfo } from './webgl-active-info.js';
2
+ import type { WebGLActiveInfo } from './webgl-active-info.js';
3
3
  import type { WebGLContextBase } from './webgl-context-base.js';
4
4
  export declare class WebGLProgram extends Linkable implements WebGLProgram {
5
5
  _ctx: WebGLContextBase;
@@ -1,7 +1,7 @@
1
1
  import Gwebgl from '@girs/gwebgl-0.1';
2
2
  import { WebGLContextBase } from './webgl-context-base.js';
3
- import { HTMLCanvasElement } from './html-canvas-element.js';
4
- import { WebGLBuffer } from './webgl-buffer.js';
3
+ import type { HTMLCanvasElement } from './html-canvas-element.js';
4
+ import type { WebGLBuffer } from './webgl-buffer.js';
5
5
  import type { WebGLConstants } from './types/index.js';
6
6
  export { WebGLContextBase } from './webgl-context-base.js';
7
7
  export interface WebGLRenderingContext extends WebGLConstants {
@@ -1,4 +1,4 @@
1
- import { WebGLTexture } from '../webgl-texture.js';
1
+ import type { WebGLTexture } from '../webgl-texture.js';
2
2
  export interface InstancedAndFramebufferOpsMethods {
3
3
  drawArraysInstanced(mode: GLenum, first: GLint, count: GLsizei, instanceCount: GLsizei): void;
4
4
  drawElementsInstanced(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, instanceCount: GLsizei): void;
@@ -1,4 +1,4 @@
1
- import { WebGLUniformLocation } from '../webgl-uniform-location.js';
1
+ import type { WebGLUniformLocation } from '../webgl-uniform-location.js';
2
2
  export interface UniformMethods {
3
3
  uniform1ui(location: WebGLUniformLocation | null, v0: GLuint): void;
4
4
  uniform2ui(location: WebGLUniformLocation | null, v0: GLuint, v1: GLuint): void;
@@ -1,13 +1,13 @@
1
1
  import Gwebgl from '@girs/gwebgl-0.1';
2
2
  import GdkPixbuf from 'gi://GdkPixbuf?version=2.0';
3
3
  import { WebGLContextBase } from './webgl-context-base.js';
4
- import { HTMLCanvasElement } from './html-canvas-element.js';
5
- import { WebGLQuery } from './webgl-query.js';
6
- import { WebGLSampler } from './webgl-sampler.js';
7
- import { WebGLSync } from './webgl-sync.js';
8
- import { WebGLTransformFeedback } from './webgl-transform-feedback.js';
9
- import { WebGLVertexArrayObject } from './webgl-vertex-array-object.js';
10
- import { WebGLUniformLocation } from './webgl-uniform-location.js';
4
+ import type { HTMLCanvasElement } from './html-canvas-element.js';
5
+ import type { WebGLQuery } from './webgl-query.js';
6
+ import type { WebGLSampler } from './webgl-sampler.js';
7
+ import type { WebGLSync } from './webgl-sync.js';
8
+ import type { WebGLTransformFeedback } from './webgl-transform-feedback.js';
9
+ import type { WebGLVertexArrayObject } from './webgl-vertex-array-object.js';
10
+ import type { WebGLUniformLocation } from './webgl-uniform-location.js';
11
11
  import { WebGLTexture } from './webgl-texture.js';
12
12
  import { WebGLFramebuffer } from './webgl-framebuffer.js';
13
13
  export declare class WebGL2RenderingContext extends WebGLContextBase implements WebGL2RenderingContext {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/webgl",
3
- "version": "0.4.28",
3
+ "version": "0.4.29",
4
4
  "description": "WebGL module for Gjs",
5
5
  "module": "lib/esm/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -39,8 +39,8 @@
39
39
  "WebGL"
40
40
  ],
41
41
  "devDependencies": {
42
- "@gjsify/cli": "^0.4.28",
43
- "@gjsify/unit": "^0.4.28",
42
+ "@gjsify/cli": "^0.4.29",
43
+ "@gjsify/unit": "^0.4.29",
44
44
  "@types/bit-twiddle": "^1.0.3",
45
45
  "@types/node": "^25.9.1",
46
46
  "typescript": "^6.0.3"
@@ -49,10 +49,10 @@
49
49
  "@girs/gjs": "4.0.1",
50
50
  "@girs/gtk-4.0": "4.23.0-4.0.1",
51
51
  "@girs/gwebgl-0.1": "0.1.0-4.0.0-rc.5",
52
- "@gjsify/dom-elements": "^0.4.28",
53
- "@gjsify/dom-events": "^0.4.28",
54
- "@gjsify/event-bridge": "^0.4.28",
55
- "@gjsify/utils": "^0.4.28",
52
+ "@gjsify/dom-elements": "^0.4.29",
53
+ "@gjsify/dom-events": "^0.4.29",
54
+ "@gjsify/event-bridge": "^0.4.29",
55
+ "@gjsify/utils": "^0.4.29",
56
56
  "bit-twiddle": "^1.0.2",
57
57
  "glsl-tokenizer": "^2.1.5"
58
58
  }