@galacean/engine-shaderlab 1.4.0-beta.0 → 1.4.0-beta.2
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.
- package/dist/browser.js +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.verbose.js +1 -1
- package/dist/browser.verbose.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.verbose.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.verbose.js +1 -1
- package/package.json +4 -4
package/dist/browser.js
CHANGED
|
@@ -6802,7 +6802,7 @@
|
|
|
6802
6802
|
ShaderLab._shaderRangePool = ShaderLabUtils.createObjectPool(ShaderRange);
|
|
6803
6803
|
|
|
6804
6804
|
//@ts-ignore
|
|
6805
|
-
var version = "1.4.0-beta.
|
|
6805
|
+
var version = "1.4.0-beta.2";
|
|
6806
6806
|
var mode = "Release";
|
|
6807
6807
|
console.log("Galacean ShaderLab version: " + version + ". mode: " + mode);
|
|
6808
6808
|
|
package/dist/browser.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@galacean/engine")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).Galacean=e.Galacean||{},e.Galacean.ShaderLab={}),e.Galacean)}(this,function(e,t){"use strict";function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function r(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return n(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(e,void 0)}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}function o(e,t,n,r){var i,a=arguments.length,o=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError;var s,c,u,l,p,h,d,_,f,S,g,v,m,y,x,E,T,C,b,A,P,R,I,O,L,k,N,G,M,D,F,B,w,U,V,W,H,j,q,z,Q,X,K,Y,J,$,Z,ee,et,en,er,ei,ea,eo,es,ec,eu,el=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t){this.start=e,this.end=t},t.dispose=function(){this.start.dispose(),this.end.dispose()},e}(),ep=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e){this.index=e},t.dispose=function(){this.index=0},e}(),eh=((s={})[s.ATTRIBUTE=0]="ATTRIBUTE",s[s.CONST=1]="CONST",s[s.BOOL=2]="BOOL",s[s.FLOAT=3]="FLOAT",s[s.DOUBLE=4]="DOUBLE",s[s.INT=5]="INT",s[s.UINT=6]="UINT",s[s.BREAK=7]="BREAK",s[s.CONTINUE=8]="CONTINUE",s[s.DO=9]="DO",s[s.ELSE=10]="ELSE",s[s.FOR=11]="FOR",s[s.IF=12]="IF",s[s.WHILE=13]="WHILE",s[s.DISCARD=14]="DISCARD",s[s.RETURN=15]="RETURN",s[s.BVEC2=16]="BVEC2",s[s.BVEC3=17]="BVEC3",s[s.BVEC4=18]="BVEC4",s[s.IVEC2=19]="IVEC2",s[s.IVEC3=20]="IVEC3",s[s.IVEC4=21]="IVEC4",s[s.UVEC2=22]="UVEC2",s[s.UVEC3=23]="UVEC3",s[s.UVEC4=24]="UVEC4",s[s.VEC2=25]="VEC2",s[s.VEC3=26]="VEC3",s[s.VEC4=27]="VEC4",s[s.VEC4_ARRAY=28]="VEC4_ARRAY",s[s.MAT2=29]="MAT2",s[s.MAT3=30]="MAT3",s[s.MAT4=31]="MAT4",s[s.MAT2X3=32]="MAT2X3",s[s.MAT2X4=33]="MAT2X4",s[s.MAT3X2=34]="MAT3X2",s[s.MAT3X4=35]="MAT3X4",s[s.MAT4X2=36]="MAT4X2",s[s.MAT4X3=37]="MAT4X3",s[s.IN=38]="IN",s[s.OUT=39]="OUT",s[s.INOUT=40]="INOUT",s[s.CENTROID=41]="CENTROID",s[s.SAMPLER2D=42]="SAMPLER2D",s[s.SAMPLER3D=43]="SAMPLER3D",s[s.SAMPLER_CUBE=44]="SAMPLER_CUBE",s[s.SAMPLER2D_SHADOW=45]="SAMPLER2D_SHADOW",s[s.SAMPLER_CUBE_SHADOW=46]="SAMPLER_CUBE_SHADOW",s[s.SAMPLER2D_ARRAY=47]="SAMPLER2D_ARRAY",s[s.SAMPLER2D_ARRAY_SHADOW=48]="SAMPLER2D_ARRAY_SHADOW",s[s.I_SAMPLER2D=49]="I_SAMPLER2D",s[s.I_SAMPLER3D=50]="I_SAMPLER3D",s[s.I_SAMPLER_CUBE=51]="I_SAMPLER_CUBE",s[s.I_SAMPLER2D_ARRAY=52]="I_SAMPLER2D_ARRAY",s[s.U_SAMPLER2D=53]="U_SAMPLER2D",s[s.U_SAMPLER3D=54]="U_SAMPLER3D",s[s.U_SAMPLER_CUBE=55]="U_SAMPLER_CUBE",s[s.U_SAMPLER2D_ARRAY=56]="U_SAMPLER2D_ARRAY",s[s.STRUCT=57]="STRUCT",s[s.LAYOUT=58]="LAYOUT",s[s.LOCATION=59]="LOCATION",s[s.VOID=60]="VOID",s[s.TRUE=61]="TRUE",s[s.FALSE=62]="FALSE",s[s.PRECISION=63]="PRECISION",s[s.PRECISE=64]="PRECISE",s[s.HIGHP=65]="HIGHP",s[s.MEDIUMP=66]="MEDIUMP",s[s.LOWP=67]="LOWP",s[s.INVARIANT=68]="INVARIANT",s[s.SMOOTH=69]="SMOOTH",s[s.FLAT=70]="FLAT",s[s.NOPERSPECTIVE=71]="NOPERSPECTIVE",s[s.GS_RenderQueueType=72]="GS_RenderQueueType",s[s.GS_BlendState=73]="GS_BlendState",s[s.GS_DepthState=74]="GS_DepthState",s[s.GS_StencilState=75]="GS_StencilState",s[s.GS_RasterState=76]="GS_RasterState",s[s.GS_EditorProperties=77]="GS_EditorProperties",s[s.GS_EditorMacros=78]="GS_EditorMacros",s[s.GS_Editor=79]="GS_Editor",s[s.GS_Tags=80]="GS_Tags",s[s.GS_ReplacementTag=81]="GS_ReplacementTag",s[s.GS_LightMode=82]="GS_LightMode",s[s.GS_PipelineStage=83]="GS_PipelineStage",s[s.GS_VertexShader=84]="GS_VertexShader",s[s.GS_FragmentShader=85]="GS_FragmentShader",s[s.GS_SubShader=86]="GS_SubShader",s[s.GS_Pass=87]="GS_Pass",s[s.GS_BlendFactor=88]="GS_BlendFactor",s[s.GS_BlendOperation=89]="GS_BlendOperation",s[s.GS_Bool=90]="GS_Bool",s[s.GS_Number=91]="GS_Number",s[s.GS_Color=92]="GS_Color",s[s.GS_CompareFunction=93]="GS_CompareFunction",s[s.GS_StencilOperation=94]="GS_StencilOperation",s[s.GS_CullMode=95]="GS_CullMode",s[s.GS_UsePass=96]="GS_UsePass",s),ed=new Map([["attribute",eh.ATTRIBUTE],["const",eh.CONST],["bool",eh.BOOL],["float",eh.FLOAT],["double",eh.DOUBLE],["int",eh.INT],["uint",eh.UINT],["break",eh.BREAK],["continue",eh.CONTINUE],["do",eh.DO],["else",eh.ELSE],["for",eh.FOR],["if",eh.IF],["while",eh.WHILE],["discard",eh.DISCARD],["return",eh.RETURN],["bvec2",eh.BVEC2],["bvec3",eh.BVEC3],["bvec4",eh.BVEC4],["ivec2",eh.IVEC2],["ivec3",eh.IVEC3],["ivec4",eh.IVEC4],["uvec2",eh.UVEC2],["uvec3",eh.UVEC3],["uvec4",eh.UVEC4],["vec2",eh.VEC2],["vec3",eh.VEC3],["vec4",eh.VEC4],["mat2",eh.MAT2],["mat3",eh.MAT3],["mat4",eh.MAT4],["in",eh.IN],["out",eh.OUT],["inout",eh.INOUT],["sampler2D",eh.SAMPLER2D],["samplerCube",eh.SAMPLER_CUBE],["sampler3D",eh.SAMPLER3D],["sampler2DShadow",eh.SAMPLER2D_SHADOW],["samplerCubeShadow",eh.SAMPLER_CUBE_SHADOW],["sampler2DArray",eh.SAMPLER2D_ARRAY],["sampler2DArrayShadow",eh.SAMPLER2D_ARRAY_SHADOW],["isampler2D",eh.I_SAMPLER2D],["isampler3D",eh.I_SAMPLER3D],["isamplerCube",eh.I_SAMPLER_CUBE],["isampler2DArray",eh.I_SAMPLER2D_ARRAY],["usampler2D",eh.U_SAMPLER2D],["usampler3D",eh.U_SAMPLER3D],["usamplerCube",eh.U_SAMPLER_CUBE],["usampler2DArray",eh.U_SAMPLER2D_ARRAY],["struct",eh.STRUCT],["void",eh.VOID],["true",eh.TRUE],["false",eh.FALSE],["precision",eh.PRECISION],["precise",eh.PRECISE],["highp",eh.HIGHP],["mediump",eh.MEDIUMP],["lowp",eh.LOWP],["invariant",eh.INVARIANT],["flat",eh.FLAT],["smooth",eh.SMOOTH],["noperspective",eh.NOPERSPECTIVE],["centroid",eh.CENTROID],["layout",eh.LAYOUT],["location",eh.LOCATION]]),e_=((c={})[c.ID=1e3]="ID",c[c.FLOAT_CONSTANT=1001]="FLOAT_CONSTANT",c[c.INT_CONSTANT=1002]="INT_CONSTANT",c[c.STRING_CONST=1003]="STRING_CONST",c[c.LEFT_OP=1004]="LEFT_OP",c[c.RIGHT_OP=1005]="RIGHT_OP",c[c.INC_OP=1006]="INC_OP",c[c.DEC_OP=1007]="DEC_OP",c[c.LE_OP=1008]="LE_OP",c[c.GE_OP=1009]="GE_OP",c[c.EQ_OP=1010]="EQ_OP",c[c.NE_OP=1011]="NE_OP",c[c.AND_OP=1012]="AND_OP",c[c.OR_OP=1013]="OR_OP",c[c.XOR_OP=1014]="XOR_OP",c[c.MUL_ASSIGN=1015]="MUL_ASSIGN",c[c.DIV_ASSIGN=1016]="DIV_ASSIGN",c[c.ADD_ASSIGN=1017]="ADD_ASSIGN",c[c.SUB_ASSIGN=1018]="SUB_ASSIGN",c[c.MOD_ASSIGN=1019]="MOD_ASSIGN",c[c.LEFT_ASSIGN=1020]="LEFT_ASSIGN",c[c.RIGHT_ASSIGN=1021]="RIGHT_ASSIGN",c[c.AND_ASSIGN=1022]="AND_ASSIGN",c[c.XOR_ASSIGN=1023]="XOR_ASSIGN",c[c.OR_ASSIGN=1024]="OR_ASSIGN",c[c.LEFT_PAREN=1025]="LEFT_PAREN",c[c.RIGHT_PAREN=1026]="RIGHT_PAREN",c[c.LEFT_BRACKET=1027]="LEFT_BRACKET",c[c.RIGHT_BRACKET=1028]="RIGHT_BRACKET",c[c.LEFT_BRACE=1029]="LEFT_BRACE",c[c.RIGHT_BRACE=1030]="RIGHT_BRACE",c[c.DOT=1031]="DOT",c[c.COMMA=1032]="COMMA",c[c.COLON=1033]="COLON",c[c.EQUAL=1034]="EQUAL",c[c.SEMICOLON=1035]="SEMICOLON",c[c.BANG=1036]="BANG",c[c.DASH=1037]="DASH",c[c.TILDE=1038]="TILDE",c[c.PLUS=1039]="PLUS",c[c.STAR=1040]="STAR",c[c.SLASH=1041]="SLASH",c[c.PERCENT=1042]="PERCENT",c[c.LEFT_ANGLE=1043]="LEFT_ANGLE",c[c.RIGHT_ANGLE=1044]="RIGHT_ANGLE",c[c.VERTICAL_BAR=1045]="VERTICAL_BAR",c[c.CARET=1046]="CARET",c[c.AMPERSAND=1047]="AMPERSAND",c[c.QUESTION=1048]="QUESTION",c[c.NOT_WORD=1049]="NOT_WORD",c[c.EPSILON=1998]="EPSILON",c[c.EOF=1999]="EOF",c);function ef(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var eS=/*#__PURE__*/function(){function e(){}return e.createObjectPool=function(n){var r=new t.ClearableObjectPool(n);return e._shaderLabObjectPoolSet.push(r),r},e.clearAllShaderLabObjectPool=function(){for(var t=0,n=e._shaderLabObjectPoolSet.length;t<n;t++)e._shaderLabObjectPoolSet[t].clear()},e.createGSError=function(e,n,r,i,a){t.Logger.error(e)},e}();eS._shaderLabObjectPoolSet=[];var eg=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t,n){if(this.type=e,this.lexeme=t,n){if(ef(n,el))this.location=n;else{var r=t_.createPosition(n.index+t.length);this.location=t_.createRange(n,r)}}},t.dispose=function(){},e}();eg.pool=eS.createObjectPool(eg);var ev=new eg;ev.set(e_.EOF,"/EOF");var em=/*#__PURE__*/function(){function e(){}return e.isNum=function(e){return e>=48&&e<=57},e.isLetter=function(e){return 95===e||e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122},e.isAlpha=function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122},e.isPpCharactors=function(e){return 35===e||46===e||95===e||e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122},e.isSpace=function(e){return 9===e||10===e||13===e||32===e},e}();function ey(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ex(e,t,n){return t&&ey(e.prototype,t),n&&ey(e,n),e}var eE=((u={}).PreprocessorError="PreprocessorError",u.CompilationError="CompilationError",u.ScannerError="ScannerError",u),eT=/*#__PURE__*/function(){function e(e,t){void 0===t&&(t=new Map),this._currentIndex=0,this._source=e,this._keywordsMap=t}var t=e.prototype;return t.getCurPosition=function(){return t_.createPosition(this._currentIndex)},t.isEnd=function(){return this._currentIndex>=this._source.length},t.getCurChar=function(){return this._source[this._currentIndex]},t.getCurCharCode=function(){return this._source.charCodeAt(this._currentIndex)},t.advance=function(e){void 0===e&&(e=1),this._currentIndex+=e},t._advance=function(){this._currentIndex++},t.skipSpace=function(t){for(var n=t?e._spaceCharsWithBreak:e._spaceChars,r=this.getCurChar();e._checkIsIn(r,n);)this._advance(),r=this.getCurChar()},t.skipCommentsAndSpace=function(){if(this.skipSpace(!0),"//"===this.peek(2)){var e=this.getCurPosition();this.advance(2);for(var t=this.getCurChar();"\n"!==t&&"\r"!==t&&!this.isEnd();)this._advance(),t=this.getCurChar();return this.skipCommentsAndSpace(),t_.createRange(e,this.getCurPosition())}if("/*"===this.peek(2)){var n=this.getCurPosition();for(this.advance(2);"*/"!==this.peek(2)&&!this.isEnd();)this._advance();return this.advance(2),this.skipCommentsAndSpace(),t_.createRange(n,this.getCurPosition())}},t.peek=function(e){var t=this._currentIndex;return this._source.substring(t,t+e)},t.scanText=function(e){this.skipCommentsAndSpace();var t=this.peek(e.length);t!==e&&this.throwError(this.getCurPosition(),'Expect text "'+e+'", but got "'+t+'"'),this.advance(e.length)},t.throwError=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw eS.createGSError(n.join(" "),eE.ScannerError,this._source,e)},t.scanPairedText=function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1),r||this.scanText(e);for(var i=this._currentIndex,a=n?1:0;this.peek(t.length)!==t||0!==a;){if(this.isEnd())return;if(n){if(this.peek(e.length)===e){a+=1,this.advance(e.length);continue}if(this.peek(t.length)===t){if(0==(a-=1))break;this.advance(t.length);continue}}this.advance(t.length)}return this.advance(t.length),this._source.substring(i,this._currentIndex-t.length)},t.scanToken=function(e,t){void 0===t&&(t=/\w/),this.skipCommentsAndSpace();var n,r=this.getCurPosition();if(!this.isEnd()){for(;t.test(this.getCurChar())&&!this.isEnd();)this._advance();var i=this.getCurPosition();if(r.index===i.index){this._advance();var a=eg.pool.get();return a.set(e_.NOT_WORD,this._source[r.index],r),null==e||e(a,this),a}var o=this._source.substring(r.index,i.index),s=null!=(n=this._keywordsMap.get(o))?n:e_.ID,c=t_.createRange(r,i),u=eg.pool.get();return u.set(s,o,c),null==e||e(u,this),u}},e._checkIsIn=function(e,t){for(var n=0;n<t.length;n++)if(e===t[n])return!0;return!1},ex(e,[{key:"current",get:function(){return this._currentIndex}},{key:"source",get:function(){return this._source}}]),e}();eT._spaceCharsWithBreak=[" "," ","\n","\r"],eT._spaceChars=[" "," "];var eC=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.reset=function(e){this._source=e,this._currentIndex=0},n.tokenize=function(){return function(e,t){var n,r,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(e){switch(e.label){case 0:if(this.isEnd())return[3,2];return[4,this.scanToken()];case 1:return e.sent(),[3,0];case 2:return[2,ev]}})},n.skipSpace=function(){for(;em.isSpace(this.getCurCharCode());)this._advance()},n.scanToken=function(){if(this.skipCommentsAndSpace(),this.isEnd())return ev;if(em.isAlpha(this.getCurCharCode()))return this._scanWord();if(em.isNum(this.getCurCharCode()))return this._scanNum();var e,t=this._getPosition(),n=eg.pool.get();switch(this.getCurChar()){case"<":if(this._advance(),"<"===(e=this.getCurChar())){if(this._advance(),"="===this.getCurChar()){this._advance(),n.set(e_.LEFT_ASSIGN,"<<=",t);break}n.set(e_.LEFT_OP,"<<",t);break}if("="===e){this._advance(),n.set(e_.LE_OP,"<=",t);break}n.set(e_.LEFT_ANGLE,"<",t);break;case">":if(this._advance(),">"===(e=this.getCurChar())){if(this._advance(),"="===this.getCurChar()){this._advance(),n.set(e_.RIGHT_ASSIGN,">>=",t);break}n.set(e_.RIGHT_OP,">>",t);break}if("="===e){this._advance(),n.set(e_.GE_OP,">=",t);break}n.set(e_.RIGHT_ANGLE,">",t);break;case"+":if(this._advance(),"+"===(e=this.getCurChar())){this._advance(),n.set(e_.INC_OP,"++",t);break}if("="===e){this._advance(),n.set(e_.ADD_ASSIGN,"+=",t);break}n.set(e_.PLUS,"+",t);break;case"-":if(this._advance(),"-"===(e=this.getCurChar())){this._advance(),n.set(e_.DEC_OP,"--",t);break}if("="===e){this._advance(),n.set(e_.SUB_ASSIGN,"-=",t);break}n.set(e_.DASH,"-",t);break;case"=":if(this._advance(),"="===this.getCurChar()){this._advance(),n.set(e_.EQ_OP,"==",t);break}n.set(e_.EQUAL,"=",t);break;case"!":if(this._advance(),"="===this.getCurChar()){this._advance(),n.set(e_.NE_OP,"!=",t);break}n.set(e_.BANG,"!",t);break;case"&":if(this._advance(),"&"===(e=this.getCurChar())){this._advance(),n.set(e_.AND_OP,"&&",t);break}if("="===e){this._advance(),n.set(e_.ADD_ASSIGN,"&=",t);break}n.set(e_.AMPERSAND,"&",t);break;case"|":if(this._advance(),"|"===(e=this.getCurChar())){this._advance(),n.set(e_.OR_OP,"||",t);break}if("="===e){this._advance(),n.set(e_.OR_ASSIGN,"|=",t);break}n.set(e_.VERTICAL_BAR,"|",t);break;case"^":if(this._advance(),"^"===(e=this.getCurChar())){this._advance(),n.set(e_.XOR_OP,"^^",t);break}if("="===e){this._advance(),n.set(e_.XOR_ASSIGN,"^=",t);break}n.set(e_.CARET,"^",t);break;case"*":if(this._advance(),"="===this.getCurChar()){this._advance(),n.set(e_.MUL_ASSIGN,"*=",t);break}n.set(e_.STAR,"*",t);break;case"/":if(this._advance(),"="===this.getCurChar()){this._advance(),n.set(e_.DIV_ASSIGN,"/=",t);break}n.set(e_.SLASH,"/",t);break;case"%":if(this._advance(),"="===this.getCurChar()){this._advance(),n.set(e_.MOD_ASSIGN,"%=",t);break}n.set(e_.PERCENT,"%",t);break;case"(":this._advance(),n.set(e_.LEFT_PAREN,"(",t);break;case")":this._advance(),n.set(e_.RIGHT_PAREN,")",t);break;case"{":this._advance(),n.set(e_.LEFT_BRACE,"{",t);break;case"}":this._advance(),n.set(e_.RIGHT_BRACE,"}",t);break;case"[":this._advance(),n.set(e_.LEFT_BRACKET,"[",t);break;case"]":this._advance(),n.set(e_.RIGHT_BRACKET,"]",t);break;case".":if(this._advance(),em.isNum(this.getCurCharCode()))return this._scanNumAfterDot();n.set(e_.DOT,".",t);break;case",":this._advance(),n.set(e_.COMMA,",",t);break;case":":this._advance(),n.set(e_.COLON,":",t);break;case";":this._advance(),n.set(e_.SEMICOLON,";",t);break;case"~":this._advance(),n.set(e_.TILDE,"~",t);break;case"?":this._advance(),n.set(e_.QUESTION,"?",t);break;case'"':return this._advance(),this._scanStringConst();default:this.throwError(this.getCurPosition(),"Unexpected character "+this.getCurChar())}return n},n._scanStringConst=function(){for(var e=this._getPosition(),t=[];'"'!==this.getCurChar();)t.push(this.getCurChar()),this._advance();this._advance();var n=t_.createRange(e,this._getPosition()),r=eg.pool.get();return r.set(e_.STRING_CONST,t.join(""),n),r},n._scanNumAfterDot=function(){for(var e=["."];em.isNum(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();var t=eg.pool.get();return t.set(e_.FLOAT_CONSTANT,e.join(""),this._getPosition(1)),t},n._getPosition=function(e){return void 0===e&&(e=0),t_.createPosition(this.current-e)},n._scanWord=function(){var e=[this.getCurChar()],t=this._getPosition();for(this._advance();em.isLetter(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();var n=e.join(""),r=ed.get(n);if(r){var i=eg.pool.get();return i.set(r,n,t),i}var a=eg.pool.get();return a.set(e_.ID,n,t),a},n._scanNum=function(){for(var e=[];em.isNum(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();if("."===this.getCurChar()){for(e.push(this.getCurChar()),this._advance();em.isNum(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();this._scanFloatSuffix(e);var t=eg.pool.get();return t.set(e_.FLOAT_CONSTANT,e.join(""),this._getPosition(e.length)),t}if("e"===this.getCurChar()||"E"===this.getCurChar()){this._scanFloatSuffix(e);var n=eg.pool.get();return n.set(e_.FLOAT_CONSTANT,e.join(""),this._getPosition(e.length)),n}this._scanIntegerSuffix(e);var r=eg.pool.get();return r.set(e_.INT_CONSTANT,e.join(""),this._getPosition(e.length)),r},n._scanFloatSuffix=function(e){if("e"===this.getCurChar()||"E"===this.getCurChar())for(e.push(this.getCurChar()),this._advance(),("+"===this.getCurChar()||"-"===this.getCurChar())&&(e.push(this.getCurChar()),this._advance()),em.isNum(this.getCurCharCode())||this.throwError(this.getCurPosition(),"lexing error, invalid exponent suffix.");em.isNum(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();("f"===this.getCurChar()||"F"===this.getCurChar())&&(e.push(this.getCurChar()),this._advance())},n._scanIntegerSuffix=function(e){("u"===this.getCurChar()||"U"===this.getCurChar())&&(e.push(this.getCurChar()),this._advance())},t}(eT),eb=((l={})[l.Shift=0]="Shift",l[l.Reduce=1]="Reduce",l[l.Accept=2]="Accept",l),eA=function(){this.globalPrecisions=[]},eP=function(e,t,n){this.type=e,this.typeLexeme=t,this.arraySpecifier=n},eR=((p={})[p.VAR=0]="VAR",p[p.FN=1]="FN",p[p.STRUCT=2]="STRUCT",p),eI=function(e,t,n,r,i){this.ident=e,this.symbolType=t,this.astNode=n,this.dataType=r,this.signature=i},eO=/*#__PURE__*/function(e){function t(t,n){var r=new eP(n.protoType.returnType.type,n.protoType.returnType.typeSpecifier.lexeme);return e.call(this,t,eR.FN,n,r)||this}return a(t,e),t}(eI),eL=/*#__PURE__*/function(e){function t(t,n){return e.call(this,t,eR.STRUCT,n)||this}return a(t,e),t}(eI),ek=function(){this._table=new Map},eN=/*#__PURE__*/function(){function e(){this.stack=[]}var t=e.prototype;return t.newScope=function(e){this.stack.push(e)},t.clear=function(){this.stack.length=0},t.dropScope=function(){this.stack.pop()},t.insert=function(e){this._scope.insert(e)},ex(e,[{key:"_scope",get:function(){return this.stack[this.stack.length-1]}}]),e}(),eG=/*#__PURE__*/function(e){function n(){return e.apply(this,arguments)||this}a(n,e);var r=n.prototype;return r.insert=function(e){for(var n,r=null!=(n=this._table.get(e.ident))?n:[],i=0;i<r.length;i++)if(this._compareWith(r[i],e.symbolType,e.signature,e.astNode)){t.Logger.warn("replace symbol:",e.ident),r[i]=e;return}r.push(e),this._table.set(e.ident,r)},r.lookup=function(e,t,n,r){var i=this._table.get(e);if(i)for(var a=i.length,o=0;o<a;o++){var s=i[o];if(this._compareWith(s,t,n,r))return s}},r.getAllFnSymbols=function(e){var t;return(null!=(t=this._table.get(e))?t:[]).filter(function(e){return e.symbolType===eR.FN})},r._compareWith=function(e,t,n,r){if(e.symbolType!==t)return!1;if(e.symbolType===eR.FN){if(!r&&!n)return!0;var i=e.astNode.protoType.paramSig,a=null!=n?n:r.protoType.paramSig,o=i.length;if(o!==a.length)return!1;for(var s=0;s<o;s++){var c=i[s],u=a[s];if(3e3!==c&&3e3!==u&&c!==u)return!1}}return!0},n}(ek),eM=/*#__PURE__*/function(e){function t(t,n,r,i){var a;return(a=e.call(this,t,eR.VAR,i,n)||this).isGlobalVariable=r,a}return a(t,e),t}(eI),eD=/*#__PURE__*/function(){function e(){this.semanticStack=[],this.acceptRule=void 0,this.symbolTableStack=new eN,this.curFunctionInfo={},this._shaderData=new eA,this._translationRuleTable=new Map,this.newScope()}var n=e.prototype;return n.reset=function(){this.semanticStack.length=0,this._shaderData=new eA,this.symbolTableStack.clear(),this.newScope()},n.newScope=function(){var e=new eG;this.symbolTableStack.newScope(e)},n.dropScope=function(){return this.symbolTableStack.dropScope()},n.addTranslationRule=function(e,t){this._translationRuleTable.set(e,t)},n.getTranslationRule=function(e){return this._translationRuleTable.get(e)},n.lookupSymbolBy=function(e,t,n,r){for(var i=this.symbolTableStack.stack,a=i.length,o=a-1;o>=0;o--){var s=i[o].lookup(e,t,n,r);if(s)return s}},n.reportError=function(e,n){t.Logger.error(n)},ex(e,[{key:"shaderData",get:function(){return this._shaderData}}]),e}(),eF=((h={})[h.START=2e3]="START",h[h.gs_shader_program=2001]="gs_shader_program",h[h.global_declaration=2002]="global_declaration",h[h.variable_declaration=2003]="variable_declaration",h[h.variable_declaration_list=2004]="variable_declaration_list",h[h.variable_declaration_statement=2005]="variable_declaration_statement",h[h.array_specifier_list=2006]="array_specifier_list",h[h.array_specifier=2007]="array_specifier",h[h.ext_builtin_type_specifier_nonarray=2008]="ext_builtin_type_specifier_nonarray",h[h.precision_specifier=2009]="precision_specifier",h[h.variable_identifier=2010]="variable_identifier",h[h.variable_identifier_node=2011]="variable_identifier_node",h[h.primary_expression=2012]="primary_expression",h[h.postfix_expression=2013]="postfix_expression",h[h.integer_expression=2014]="integer_expression",h[h.function_call=2015]="function_call",h[h.function_call_generic=2016]="function_call_generic",h[h.function_call_header_no_parameters=2017]="function_call_header_no_parameters",h[h.function_call_header_with_parameters=2018]="function_call_header_with_parameters",h[h.function_call_parameter_list=2019]="function_call_parameter_list",h[h.function_call_header=2020]="function_call_header",h[h.function_identifier=2021]="function_identifier",h[h.constructor_identifier=2022]="constructor_identifier",h[h.unary_expression=2023]="unary_expression",h[h.unary_operator=2024]="unary_operator",h[h.multiplicative_expression=2025]="multiplicative_expression",h[h.additive_expression=2026]="additive_expression",h[h.shift_expression=2027]="shift_expression",h[h.relational_expression=2028]="relational_expression",h[h.equality_expression=2029]="equality_expression",h[h.and_expression=2030]="and_expression",h[h.inclusive_or_expression=2031]="inclusive_or_expression",h[h.exclusive_or_expression=2032]="exclusive_or_expression",h[h.logical_and_expression=2033]="logical_and_expression",h[h.logical_xor_expression=2034]="logical_xor_expression",h[h.logical_or_expression=2035]="logical_or_expression",h[h.conditional_expression=2036]="conditional_expression",h[h.assignment_expression=2037]="assignment_expression",h[h.assignment_operator=2038]="assignment_operator",h[h.expression=2039]="expression",h[h.integer_constant_expression=2040]="integer_constant_expression",h[h.integer_constant_expression_operator=2041]="integer_constant_expression_operator",h[h.declaration=2042]="declaration",h[h.function_prototype=2043]="function_prototype",h[h.function_declarator=2044]="function_declarator",h[h.function_header_with_parameters=2045]="function_header_with_parameters",h[h.function_header=2046]="function_header",h[h.function_parameter_list=2047]="function_parameter_list",h[h.parameter_declarator=2048]="parameter_declarator",h[h.parameter_declaration=2049]="parameter_declaration",h[h.parameter_qualifier=2050]="parameter_qualifier",h[h.parameter_type_specifier=2051]="parameter_type_specifier",h[h.init_declarator_list=2052]="init_declarator_list",h[h.single_declaration=2053]="single_declaration",h[h.fully_specified_type=2054]="fully_specified_type",h[h.type_qualifier=2055]="type_qualifier",h[h.single_type_qualifier=2056]="single_type_qualifier",h[h.storage_qualifier=2057]="storage_qualifier",h[h.precision_qualifier=2058]="precision_qualifier",h[h.interpolation_qualifier=2059]="interpolation_qualifier",h[h.invariant_qualifier=2060]="invariant_qualifier",h[h.type_specifier=2061]="type_specifier",h[h.type_specifier_nonarray=2062]="type_specifier_nonarray",h[h.type_specifier_no_prec=2063]="type_specifier_no_prec",h[h.basic_type=2064]="basic_type",h[h.struct_specifier=2065]="struct_specifier",h[h.struct_declaration_list=2066]="struct_declaration_list",h[h.struct_declaration=2067]="struct_declaration",h[h.layout_qualifier=2068]="layout_qualifier",h[h.struct_declarator_list=2069]="struct_declarator_list",h[h.struct_declarator=2070]="struct_declarator",h[h.identifier_list=2071]="identifier_list",h[h.decl_identifier=2072]="decl_identifier",h[h.initializer=2073]="initializer",h[h.initializer_list=2074]="initializer_list",h[h.declaration_statement=2075]="declaration_statement",h[h.simple_statement=2076]="simple_statement",h[h.compound_statement_no_scope=2077]="compound_statement_no_scope",h[h.statement_with_scope=2078]="statement_with_scope",h[h.compound_statement=2079]="compound_statement",h[h.statement=2080]="statement",h[h.statement_list=2081]="statement_list",h[h.iteration_statement_no_new_scope=2082]="iteration_statement_no_new_scope",h[h.expression_statement=2083]="expression_statement",h[h.selection_statement=2084]="selection_statement",h[h.selection_rest_statement=2085]="selection_rest_statement",h[h.condition=2086]="condition",h[h.conditionopt=2087]="conditionopt",h[h.iteration_statement=2088]="iteration_statement",h[h.for_init_statement=2089]="for_init_statement",h[h.for_rest_statement=2090]="for_rest_statement",h[h.jump_statement=2091]="jump_statement",h[h.external_declaration=2092]="external_declaration",h[h.function_definition=2093]="function_definition",h[h.field_selection=2094]="field_selection",h[h.bool_constant=2095]="bool_constant",h[h.function_identifier_node=2096]="function_identifier_node",h[h.typename_identifier_node=2097]="typename_identifier_node",h[h.scope_brace=2098]="scope_brace",h[h.scope_end_brace=2099]="scope_end_brace",h[h._ignore=2100]="_ignore",h),eB=function e(t,n){this.goal=t,this.derivation=n,this.id=e._id++,e.pool.set(this.id,this)};eB._id=0,eB.pool=new Map;var ew=/*#__PURE__*/function(){function e(e,t){this.startSymbol=e,t.unshift(new eB(eF.START,[e])),this.productions=t}var t=e.prototype;return t.getProductionList=function(e){return this.productions.filter(function(t){return t.goal===e})},t.isNullableNT=function(e){return this.productions.find(function(t){return t.goal===e&&t.derivation[0]===e_.EPSILON})},t.getProductionByID=function(e){return eB.pool.get(e)},e.create=function(t,n){return new e(t,n.map(function(e){return new eB(e[0],e.slice(1))}))},e}(),eU=function(e,t,n){this.type=e,this.typeLexeme=t,this.arraySpecifier=n},eV=function(e,t,n){this.typeInfo=e,this.ident=t,this.mrtIndex=n};function eW(e){return function(t){t.prototype.nt=e,t.pool=eS.createObjectPool(t)}}var eH=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t){this._location=e,this._children=t,this.init()},t.init=function(){},t.dispose=function(){},t.codeGen=function(e){return e.defaultCodeGen(this.children)},t.semanticAnalyze=function(e){},ex(e,[{key:"children",get:function(){return this._children}},{key:"location",get:function(){return this._location}}]),e}();(d=eu||(eu={}))._unwrapToken=function(e){if(ef(e,eg))return e;throw"not token"},d.get=function(e,t,n,r){var i=e.get();i.set(n,r),i.semanticAnalyze(t),t.semanticStack.push(i)},_=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(eH),d.TrivialNode=_,_=o([eW(eF._ignore)],_),f=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.newScope()},t}(eH),d.ScopeBrace=f,f=o([eW(eF.scope_brace)],f),S=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.dropScope()},t}(eH),d.ScopeEndBrace=S,S=o([eW(eF.scope_end_brace)],S),g=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.init=function(){this.isFragReturnStatement=!1},n.semanticAnalyze=function(e){d._unwrapToken(this.children[0]).type===eh.RETURN&&(e.curFunctionInfo.returnStatement=this)},n.codeGen=function(e){return e.visitJumpStatement(this)},t}(eH),d.JumpStatement=g,g=o([eW(eF.jump_statement)],g),v=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){this._type=void 0},ex(t,[{key:"type",get:function(){var e;return null!=(e=this._type)?e:3e3},set:function(e){this._type=e}}]),t}(eH),d.ExpressionAstNode=v,m=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.init=function(){this.typeSpecifier=void 0,this.arraySpecifier=void 0},n.semanticAnalyze=function(e){var t,n=this.children,r=n.length,i=n[0],a=i.typeSpecifier;this.typeSpecifier=a,this.arraySpecifier=a.arraySpecifier;var o=n[1];if(2===r||4===r){var s=new eU(i.type,a.lexeme,this.arraySpecifier),c=n[3];t=new eM(o.lexeme,s,!1,c)}else{var u=n[2];this.arraySpecifier=u;var l=new eU(i.type,a.lexeme,this.arraySpecifier),p=n[4];t=new eM(o.lexeme,l,!1,p)}e.symbolTableStack.insert(t)},n.codeGen=function(e){return e.visitSingleDeclaration(this)},t}(eH),d.SingleDeclaration=m,m=o([eW(eF.single_declaration)],m),y=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"qualifierList",get:function(){if(this.children.length>1)return this.children[0].qualifierList}},{key:"typeSpecifier",get:function(){return 1===this.children.length?this.children[0]:this.children[1]}},{key:"type",get:function(){return this.typeSpecifier.type}}]),t}(eH),d.FullySpecifiedType=y,y=o([eW(eF.fully_specified_type)],y),x=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){this.children.length>1?this.qualifierList=[].concat(this.children[0].qualifierList,[this.children[1].qualifier]):this.qualifierList=[this.children[0].qualifier]},t}(eH),d.TypeQualifier=x,x=o([eW(eF.type_qualifier)],x),E=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];ef(t,eg)?this.qualifier=t.type:this.qualifier=t.qualifier,this.lexeme=t.lexeme},t}(eH),d.SingleTypeQualifier=E,E=o([eW(eF.single_type_qualifier)],E),T=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"type",get:function(){return this.children[0].type}},{key:"lexeme",get:function(){return this.children[0].lexeme}},{key:"arraySize",get:function(){var e,t;return null==(t=this.children)?void 0:null==(e=t[1])?void 0:e.size}},{key:"arraySpecifier",get:function(){return this.children[1]}},{key:"isCustom",get:function(){return"string"==typeof this.type}}]),t}(eH),d.TypeSpecifier=T,T=o([eW(eF.type_specifier)],T),C=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"size",get:function(){return this.children[1].value}}]),t}(eH),d.ArraySpecifier=C,C=o([eW(eF.array_specifier)],C),b=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];switch(t.type){case e_.PLUS:this.compute=function(e,t){return e+t};break;case e_.DASH:this.compute=function(e,t){return e-t};break;case e_.STAR:this.compute=function(e,t){return e*t};break;case e_.SLASH:this.compute=function(e,t){return e/t};break;case e_.PERCENT:this.compute=function(e,t){return e%t};break;default:e.reportError(t.location,"not implemented operator "+t.lexeme)}},ex(t,[{key:"lexeme",get:function(){return this.children[0].lexeme}}]),t}(eH),d.IntegerConstantExpressionOperator=b,b=o([eW(eF.integer_constant_expression_operator)],b),A=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.init=function(){this.value=void 0},n.semanticAnalyze=function(e){if(1===this.children.length){var t=this.children[0];ef(t,eg)&&(this.value=Number(t.lexeme))}},t}(eH),d.IntegerConstantExpression=A,A=o([eW(eF.integer_constant_expression)],A),P=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){var e=this.children[0];ef(e,eg)?this.type=e.lexeme:this.type=e.type,this.lexeme=e.lexeme},t}(eH),d.TypeSpecifierNonArray=P,P=o([eW(eF.type_specifier_nonarray)],P),R=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){var e=this.children[0];this.type=e.type,this.lexeme=e.lexeme},t}(eH),d.ExtBuiltinTypeSpecifierNonArray=R,R=o([eW(eF.ext_builtin_type_specifier_nonarray)],R),I=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t;if(3===this.children.length||5===this.children.length)t=new eM(this.children[2].lexeme,this.typeInfo,!1,this),e.symbolTableStack.insert(t);else if(4===this.children.length||6===this.children.length){var n=this.typeInfo,r=this.children[3];n.arraySpecifier=r,t=new eM(this.children[2].lexeme,n,!1,this),e.symbolTableStack.insert(t)}},ex(t,[{key:"typeInfo",get:function(){if(1===this.children.length){var e=this.children[0];return new eU(e.typeSpecifier.type,e.typeSpecifier.lexeme,e.arraySpecifier)}return this.children[0].typeInfo}}]),t}(eH),d.InitDeclaratorList=I,I=o([eW(eF.init_declarator_list)],I),O=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"idList",get:function(){return 2===this.children.length?[this.children[1]]:[].concat(this.children[0].idList,[this.children[2]])}}]),t}(eH),d.IdentifierList=O,O=o([eW(eF.identifier_list)],O),L=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return e.visitDeclaration(this)},t}(eH),d.Declaration=L,L=o([eW(eF.declaration)],L),k=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return e.visitFunctionProtoType(this)},ex(t,[{key:"declarator",get:function(){return this.children[0]}},{key:"ident",get:function(){return this.declarator.ident}},{key:"returnType",get:function(){return this.declarator.returnType}},{key:"parameterList",get:function(){return this.declarator.parameterInfoList}},{key:"paramSig",get:function(){return this.declarator.paramSig}}]),t}(eH),d.FunctionProtoType=k,k=o([eW(eF.function_prototype)],k),N=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.curFunctionInfo.returnStatement=null,e.curFunctionInfo.header=this},ex(t,[{key:"header",get:function(){return this.children[0]}},{key:"parameterList",get:function(){return this.children[1]}},{key:"ident",get:function(){return this.header.ident}},{key:"returnType",get:function(){return this.header.returnType}},{key:"parameterInfoList",get:function(){var e;return null==(e=this.parameterList)?void 0:e.parameterInfoList}},{key:"paramSig",get:function(){var e;return null==(e=this.parameterList)?void 0:e.paramSig}}]),t}(eH),d.FunctionDeclarator=N,N=o([eW(eF.function_declarator)],N),G=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.semanticAnalyze=function(e){e.newScope()},n.codeGen=function(e){return e.visitFunctionHeader(this)},ex(t,[{key:"ident",get:function(){return this.children[1]}},{key:"returnType",get:function(){return this.children[0]}}]),t}(eH),d.FunctionHeader=G,G=o([eW(eF.function_header)],G),M=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return e.visitFunctionParameterList(this)},ex(t,[{key:"parameterInfoList",get:function(){if(1===this.children.length){var e=this.children[0];return[{ident:e.ident,typeInfo:e.typeInfo,astNode:e}]}var t=this.children[0],n=this.children[2];return[].concat(t.parameterInfoList,[{ident:n.ident,typeInfo:n.typeInfo,astNode:n}])}},{key:"paramSig",get:function(){if(1===this.children.length)return[this.children[0].typeInfo.type];var e=this.children[0],t=this.children[2];return e.paramSig.concat([t.typeInfo.type])}}]),t}(eH),d.FunctionParameterList=M,M=o([eW(eF.function_parameter_list)],M),D=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t,n=new eM((t=1===this.children.length?this.children[0]:this.children[1]).ident.lexeme,t.typeInfo,!1,this);e.symbolTableStack.insert(n)},ex(t,[{key:"typeQualifier",get:function(){if(2===this.children.length)return this.children[0]}},{key:"parameterDeclarator",get:function(){return 1===this.children.length?this.children[0]:this.children[1]}},{key:"typeInfo",get:function(){return this.parameterDeclarator.typeInfo}},{key:"ident",get:function(){return this.parameterDeclarator.ident}}]),t}(eH),d.ParameterDeclaration=D,D=o([eW(eF.parameter_declaration)],D),F=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"ident",get:function(){return this.children[1]}},{key:"typeInfo",get:function(){var e=this.children[0],t=this.children[2];return new eU(e.type,e.lexeme,t)}}]),t}(eH),d.ParameterDeclarator=F,F=o([eW(eF.parameter_declarator)],F),B=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(eH),d.CompoundStatementNoScope=B,B=o([eW(eF.compound_statement_no_scope)],B),w=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return e.visitStatementList(this)},t}(eH),d.StatementList=w,w=o([eW(eF.statement_list)],w),U=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.init=function(){this._returnStatement=void 0},n.semanticAnalyze=function(e){e.dropScope();var t=new eO(this.protoType.ident.lexeme,this);e.symbolTableStack.insert(t);var n=e.curFunctionInfo,r=n.header,i=n.returnStatement;r.returnType.type===eh.VOID?i&&e.reportError(r.returnType.location,"Return in void function."):i?this._returnStatement=i:e.reportError(r.returnType.location,"No return statement found."),n.header=void 0,n.returnStatement=void 0},n.codeGen=function(e){return e.visitFunctionDefinition(this)},ex(t,[{key:"returnStatement",get:function(){return this._returnStatement}},{key:"protoType",get:function(){return this.children[0]}},{key:"statements",get:function(){return this.children[1]}}]),t}(eH),d.FunctionDefinition=U,U=o([eW(eF.function_definition)],U),V=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.semanticAnalyze=function(e){this.type=this.children[0].type},n.codeGen=function(e){return e.visitFunctionCall(this)},t}(v),d.FunctionCall=V,V=o([eW(eF.function_call)],V),W=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.init=function(){e.prototype.init.call(this),this.fnSymbol=void 0},n.semanticAnalyze=function(e){var t=this.children[0];if(t.isBuiltin)this.type=t.ident;else{var n,r,i=t.ident;if(4===this.children.length){var a=this.children[2];ef(a,H)&&(r=a.paramSig)}var o=e.lookupSymbolBy(i,eR.FN,r);if(!o)return;this.type=null==o?void 0:null==(n=o.dataType)?void 0:n.type,this.fnSymbol=o}},t}(v),d.FunctionCallGeneric=W,W=o([eW(eF.function_call_generic)],W),H=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"paramSig",get:function(){if(1===this.children.length){var e=this.children[0];return void 0==e.type?[3e3]:[e.type]}var t=this.children[0],n=this.children[2];return void 0==t.paramSig||void 0==n.type?[3e3]:t.paramSig.concat([n.type])}},{key:"paramNodes",get:function(){if(1===this.children.length)return[this.children[0]];var e=this.children[0],t=this.children[2];return e.paramNodes.concat([t])}}]),t}(eH),d.FunctionCallParameterList=H,H=o([eW(eF.function_call_parameter_list)],H),j=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.shaderData.globalPrecisions.push(this)},t}(eH),d.PrecisionSpecifier=j,j=o([eW(eF.precision_specifier)],j),q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.semanticAnalyze=function(e){},n.codeGen=function(e){return e.visitFunctionIdentifier(this)},ex(t,[{key:"ident",get:function(){return this.children[0].type}},{key:"lexeme",get:function(){return this.children[0].lexeme}},{key:"isBuiltin",get:function(){return"string"!=typeof this.ident}}]),t}(eH),d.FunctionIdentifier=q,q=o([eW(eF.function_identifier)],q),z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(v),d.AssignmentExpression=z,z=o([eW(eF.assignment_expression)],z),Q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(v),d.Expression=Q,Q=o([eW(eF.expression)],Q),X=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,n=this.children[0];if(ef(n,ei))this.type=null!=(t=n.typeInfo)?t:3e3;else switch(n.type){case e_.INT_CONSTANT:this._type=eh.INT;break;case e_.FLOAT_CONSTANT:this.type=eh.FLOAT;break;case eh.TRUE:case eh.FALSE:this.type=eh.BOOL}}else{var r=this.children[1];this.type=r.type}},t}(v),d.PrimaryExpression=X,X=o([eW(eF.primary_expression)],X),K=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.init=function(){if(e.prototype.init.call(this),1===this.children.length){var t=this.children[0];this.type=t.type}},n.codeGen=function(e){return e.visitPostfixExpression(this)},t}(v),d.PostfixExpression=K,K=o([eW(eF.postfix_expression)],K),Y=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){6===this.children.length&&(this.ident=this.children[1],e.symbolTableStack.insert(new eL(this.ident.lexeme,this)))},ex(t,[{key:"propList",get:function(){return(6===this.children.length?this.children[3]:this.children[2]).propList}}]),t}(eH),d.StructSpecifier=Y,Y=o([eW(eF.struct_specifier)],Y),J=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"propList",get:function(){if(1===this.children.length)return this.children[0].propList;var e=this.children[0],t=this.children[1];return[e.propList,t.propList].flat()}}]),t}(eH),d.StructDeclarationList=J,J=o([eW(eF.struct_declaration_list)],J),$=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"typeSpecifier",get:function(){return 3===this.children.length?this.children[0]:this.children[1]}},{key:"declaratorList",get:function(){return 3===this.children.length?this.children[1]:this.children[2]}},{key:"propList",get:function(){var e=[],t=this.children[0];if(ef(t,Z)){var n=this.children[1],r=this.children[2],i=new eV(new eU(n.type,n.lexeme),r.ident,t.index);e.push(i)}else for(var a=0;a<this.declaratorList.declaratorList.length;a++){var o=this.declaratorList.declaratorList[a],s=new eV(new eU(this.typeSpecifier.type,this.typeSpecifier.lexeme,o.arraySpecifier),o.ident);e.push(s)}return e}}]),t}(eH),d.StructDeclaration=$,$=o([eW(eF.struct_declaration)],$),Z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"index",get:function(){return Number(this.children[4].lexeme)}}]),t}(eH),d.LayoutQualifier=Z,Z=o([eW(eF.layout_qualifier)],Z),ee=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"declaratorList",get:function(){return 1===this.children.length?[this.children[0]]:[].concat(this.children[0].declaratorList,[this.children[1]])}}]),t}(eH),d.StructDeclaratorList=ee,ee=o([eW(eF.struct_declarator_list)],ee),et=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"ident",get:function(){return this.children[0]}},{key:"arraySpecifier",get:function(){return this.children[1]}}]),t}(eH),d.StructDeclarator=et,et=o([eW(eF.struct_declarator)],et),en=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.semanticAnalyze=function(e){var t=this.children,n=t[0],r=t[1];this.type=n;var i=new eM(r.lexeme,new eU(n.type,n.typeSpecifier.lexeme),!0,this);e.symbolTableStack.insert(i)},n.codeGen=function(e){return e.visitGlobalVariableDeclaration(this)+";"},t}(eH),d.VariableDeclaration=en,en=o([eW(eF.variable_declaration)],en),er=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children,n=t.length,r=t[0].type;if(this.type=r,1!==n){var i=t[2],a=en.pool.get();3===n?a.set(i.location,[r,i]):a.set(i.location,[r,i,t[3]]),a.semanticAnalyze(e)}},t}(eH),d.VariableDeclarationList=er,er=o([eW(eF.variable_declaration_list)],er),ei=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.semanticAnalyze=function(e){var t=this.children[0];this.symbolInfo=e.lookupSymbolBy(t.lexeme,eR.VAR)},n.codeGen=function(e){return e.visitVariableIdentifier(this)},ex(t,[{key:"lexeme",get:function(){return this.children[0].lexeme}},{key:"typeInfo",get:function(){var e;return ef(this.symbolInfo,eM)?this.symbolInfo.dataType.type:null==(e=this.symbolInfo)?void 0:e.type}}]),t}(eH),d.VariableIdentifier=ei,ei=o([eW(eF.variable_identifier)],ei),ea=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){this.shaderData=e.shaderData,this.shaderData.symbolTable=e.symbolTableStack._scope},t}(eH),d.GLShaderProgram=ea,o([eW(eF.gs_shader_program)],ea);var ej=/*#__PURE__*/function(){function e(){}return e.isTerminal=function(e){return e<eF.START},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=e_[e])?t:eh[e]}return eF[e]},e.createProductionWithOptions=function(e,t,n){for(var i,a=[],o=r(t);!(i=o()).done;){var s=i.value;a.push([[].concat([e],s),function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];if(r[0]){var a=r[0].location.start,o=r[r.length-1].location.end,s=t_.createRange(a,o);eu.get(null!=n?n:eu.TrivialNode.pool,e,s,r)}}])}return a},e.addMapSetItem=function(e,t,n){var r,i=null!=(r=e.get(t))?r:new Set;i.add(n),e.set(t,i)},e.isSubSet=function(e,t){for(var n,i=r(e);!(n=i()).done;){var a=n.value;if(!t.has(a))return!1}return!0},e.isActionEqual=function(e,t){return e.action===t.action&&e.target===t.target},e}(),eq=[].concat(ej.createProductionWithOptions(eF.gs_shader_program,[[eF.global_declaration],[eF.gs_shader_program,eF.global_declaration]],eu.GLShaderProgram.pool),ej.createProductionWithOptions(eF.global_declaration,[[eF.precision_specifier],[eF.variable_declaration_statement],[eF.struct_specifier],[eF.function_definition]]),ej.createProductionWithOptions(eF.variable_declaration,[[eF.fully_specified_type,e_.ID],[eF.fully_specified_type,e_.ID,eF.array_specifier]],eu.VariableDeclaration.pool),ej.createProductionWithOptions(eF.variable_declaration_list,[[eF.variable_declaration],[eF.variable_declaration_list,e_.COMMA,e_.ID],[eF.variable_declaration_list,e_.COMMA,e_.ID,eF.array_specifier]],eu.VariableDeclarationList.pool),ej.createProductionWithOptions(eF.variable_declaration_statement,[[eF.variable_declaration_list,e_.SEMICOLON]]),ej.createProductionWithOptions(eF.ext_builtin_type_specifier_nonarray,[[eh.VOID],[eh.FLOAT],[eh.BOOL],[eh.INT],[eh.UINT],[eh.VEC2],[eh.VEC3],[eh.VEC4],[eh.BVEC2],[eh.BVEC3],[eh.BVEC4],[eh.IVEC2],[eh.IVEC3],[eh.IVEC4],[eh.UVEC2],[eh.UVEC3],[eh.UVEC4],[eh.MAT2],[eh.MAT3],[eh.MAT4],[eh.MAT2X3],[eh.MAT2X4],[eh.MAT3X2],[eh.MAT3X4],[eh.MAT4X2],[eh.MAT4X3],[eh.SAMPLER2D],[eh.SAMPLER3D],[eh.SAMPLER_CUBE],[eh.SAMPLER2D_SHADOW],[eh.SAMPLER_CUBE_SHADOW],[eh.SAMPLER2D_ARRAY],[eh.SAMPLER2D_ARRAY_SHADOW],[eh.I_SAMPLER2D],[eh.I_SAMPLER3D],[eh.I_SAMPLER_CUBE],[eh.I_SAMPLER2D_ARRAY],[eh.U_SAMPLER2D],[eh.U_SAMPLER3D],[eh.U_SAMPLER_CUBE],[eh.U_SAMPLER2D_ARRAY]],eu.ExtBuiltinTypeSpecifierNonArray.pool),ej.createProductionWithOptions(eF.type_specifier_nonarray,[[e_.ID],[eF.ext_builtin_type_specifier_nonarray]],eu.TypeSpecifierNonArray.pool),ej.createProductionWithOptions(eF.fully_specified_type,[[eF.type_specifier],[eF.type_qualifier,eF.type_specifier]],eu.FullySpecifiedType.pool),ej.createProductionWithOptions(eF.type_specifier,[[eF.type_specifier_nonarray],[eF.ext_builtin_type_specifier_nonarray,eF.array_specifier]],eu.TypeSpecifier.pool),ej.createProductionWithOptions(eF.type_qualifier,[[eF.single_type_qualifier],[eF.type_qualifier,eF.single_type_qualifier]],eu.TypeQualifier.pool),ej.createProductionWithOptions(eF.single_type_qualifier,[[eF.storage_qualifier],[eF.precision_qualifier],[eF.interpolation_qualifier],[eF.invariant_qualifier],[eh.PRECISE]],eu.SingleTypeQualifier.pool),ej.createProductionWithOptions(eF.storage_qualifier,[[eh.CONST],[eh.IN],[eh.INOUT],[eh.OUT],[eh.CENTROID]]),ej.createProductionWithOptions(eF.interpolation_qualifier,[[eh.SMOOTH],[eh.FLAT]]),ej.createProductionWithOptions(eF.invariant_qualifier,[[eh.INVARIANT]]),ej.createProductionWithOptions(eF.precision_qualifier,[[eh.HIGHP],[eh.MEDIUMP],[eh.LOWP]]),ej.createProductionWithOptions(eF.struct_specifier,[[eh.STRUCT,e_.ID,e_.LEFT_BRACE,eF.struct_declaration_list,e_.RIGHT_BRACE,e_.SEMICOLON],[eh.STRUCT,e_.LEFT_BRACE,eF.struct_declaration_list,e_.RIGHT_BRACE,e_.SEMICOLON]],eu.StructSpecifier.pool),ej.createProductionWithOptions(eF.struct_declaration_list,[[eF.struct_declaration],[eF.struct_declaration_list,eF.struct_declaration]],eu.StructDeclarationList.pool),ej.createProductionWithOptions(eF.struct_declaration,[[eF.type_specifier,eF.struct_declarator_list,e_.SEMICOLON],[eF.type_qualifier,eF.type_specifier,eF.struct_declarator_list,e_.SEMICOLON],[eF.layout_qualifier,eF.type_specifier,eF.struct_declarator,e_.SEMICOLON]],eu.StructDeclaration.pool),ej.createProductionWithOptions(eF.layout_qualifier,[[eh.LAYOUT,e_.LEFT_PAREN,eh.LOCATION,e_.EQUAL,e_.INT_CONSTANT,e_.RIGHT_PAREN]],eu.LayoutQualifier.pool),ej.createProductionWithOptions(eF.struct_declarator_list,[[eF.struct_declarator],[eF.struct_declarator_list,e_.COMMA,eF.struct_declarator]],eu.StructDeclaratorList.pool),ej.createProductionWithOptions(eF.struct_declarator,[[e_.ID],[e_.ID,eF.array_specifier]],eu.StructDeclarator.pool),ej.createProductionWithOptions(eF.array_specifier,[[e_.LEFT_BRACKET,e_.RIGHT_BRACKET],[e_.LEFT_BRACKET,eF.integer_constant_expression,e_.RIGHT_BRACKET]],eu.ArraySpecifier.pool),ej.createProductionWithOptions(eF.integer_constant_expression_operator,[[e_.PLUS],[e_.DASH],[e_.STAR],[e_.SLASH],[e_.PERCENT]],eu.IntegerConstantExpressionOperator.pool),ej.createProductionWithOptions(eF.integer_constant_expression,[[eF.variable_identifier],[e_.INT_CONSTANT],[eF.integer_constant_expression,eF.integer_constant_expression_operator,e_.INT_CONSTANT],[eF.integer_constant_expression,eF.integer_constant_expression_operator,eF.variable_identifier]],eu.IntegerConstantExpression.pool),ej.createProductionWithOptions(eF.conditional_expression,[[eF.logical_or_expression],[eF.logical_or_expression,e_.QUESTION,eF.expression,e_.COLON,eF.assignment_expression]]),ej.createProductionWithOptions(eF.logical_or_expression,[[eF.logical_xor_expression],[eF.logical_or_expression,e_.OR_OP,eF.logical_xor_expression]]),ej.createProductionWithOptions(eF.logical_xor_expression,[[eF.logical_and_expression],[eF.logical_xor_expression,e_.XOR_OP,eF.logical_and_expression]]),ej.createProductionWithOptions(eF.logical_and_expression,[[eF.inclusive_or_expression],[eF.logical_and_expression,e_.AND_OP,eF.inclusive_or_expression]]),ej.createProductionWithOptions(eF.inclusive_or_expression,[[eF.exclusive_or_expression],[eF.inclusive_or_expression,e_.VERTICAL_BAR,eF.exclusive_or_expression]]),ej.createProductionWithOptions(eF.exclusive_or_expression,[[eF.and_expression],[eF.exclusive_or_expression,e_.CARET,eF.and_expression]]),ej.createProductionWithOptions(eF.and_expression,[[eF.equality_expression],[eF.and_expression,e_.AMPERSAND,eF.equality_expression]]),ej.createProductionWithOptions(eF.equality_expression,[[eF.relational_expression],[eF.equality_expression,e_.EQ_OP,eF.relational_expression],[eF.equality_expression,e_.NE_OP,eF.relational_expression]]),ej.createProductionWithOptions(eF.relational_expression,[[eF.shift_expression],[eF.relational_expression,e_.LEFT_ANGLE,eF.shift_expression],[eF.relational_expression,e_.RIGHT_ANGLE,eF.shift_expression],[eF.relational_expression,e_.LE_OP,eF.shift_expression],[eF.relational_expression,e_.GE_OP,eF.shift_expression]]),ej.createProductionWithOptions(eF.shift_expression,[[eF.additive_expression],[eF.shift_expression,e_.LEFT_OP,eF.additive_expression],[eF.shift_expression,e_.RIGHT_OP,eF.additive_expression]]),ej.createProductionWithOptions(eF.additive_expression,[[eF.multiplicative_expression],[eF.additive_expression,e_.PLUS,eF.multiplicative_expression],[eF.additive_expression,e_.DASH,eF.multiplicative_expression]]),ej.createProductionWithOptions(eF.multiplicative_expression,[[eF.unary_expression],[eF.multiplicative_expression,e_.STAR,eF.unary_expression],[eF.multiplicative_expression,e_.SLASH,eF.unary_expression],[eF.multiplicative_expression,e_.PERCENT,eF.unary_expression]]),ej.createProductionWithOptions(eF.unary_expression,[[eF.postfix_expression],[e_.INC_OP,eF.unary_expression],[e_.DEC_OP,eF.unary_expression],[eF.unary_operator,eF.unary_expression]]),ej.createProductionWithOptions(eF.unary_operator,[[e_.PLUS],[e_.DASH],[e_.BANG],[e_.TILDE]]),ej.createProductionWithOptions(eF.postfix_expression,[[eF.primary_expression],[eF.postfix_expression,e_.LEFT_BRACKET,eF.expression,e_.RIGHT_BRACKET],[eF.function_call],[eF.postfix_expression,e_.DOT,e_.ID],[eF.postfix_expression,e_.DOT,eF.function_call],[eF.postfix_expression,e_.INC_OP],[eF.postfix_expression,e_.DEC_OP]],eu.PostfixExpression.pool),ej.createProductionWithOptions(eF.primary_expression,[[eF.variable_identifier],[e_.INT_CONSTANT],[e_.FLOAT_CONSTANT],[eh.TRUE],[eh.FALSE],[e_.LEFT_PAREN,eF.expression,e_.RIGHT_PAREN]],eu.PrimaryExpression.pool),ej.createProductionWithOptions(eF.expression,[[eF.assignment_expression],[eF.expression,e_.COMMA,eF.assignment_expression]],eu.Expression.pool),ej.createProductionWithOptions(eF.assignment_expression,[[eF.conditional_expression],[eF.unary_expression,eF.assignment_operator,eF.assignment_expression]],eu.AssignmentExpression.pool),ej.createProductionWithOptions(eF.assignment_operator,[[e_.EQUAL],[e_.MUL_ASSIGN],[e_.DIV_ASSIGN],[e_.MOD_ASSIGN],[e_.ADD_ASSIGN],[e_.SUB_ASSIGN],[e_.LEFT_ASSIGN],[e_.RIGHT_ASSIGN],[e_.AND_ASSIGN],[e_.XOR_ASSIGN],[e_.OR_ASSIGN]]),ej.createProductionWithOptions(eF.function_call,[[eF.function_call_generic]],eu.FunctionCall.pool),ej.createProductionWithOptions(eF.function_call_generic,[[eF.function_identifier,e_.LEFT_PAREN,eF.function_call_parameter_list,e_.RIGHT_PAREN],[eF.function_identifier,e_.LEFT_PAREN,e_.RIGHT_PAREN],[eF.function_identifier,eh.VOID,e_.RIGHT_PAREN]],eu.FunctionCallGeneric.pool),ej.createProductionWithOptions(eF.function_call_parameter_list,[[eF.assignment_expression],[eF.function_call_parameter_list,e_.COMMA,eF.assignment_expression]],eu.FunctionCallParameterList.pool),ej.createProductionWithOptions(eF.function_identifier,[[eF.type_specifier]],eu.FunctionIdentifier.pool),ej.createProductionWithOptions(eF.function_definition,[[eF.function_prototype,eF.compound_statement_no_scope]],eu.FunctionDefinition.pool),ej.createProductionWithOptions(eF.function_prototype,[[eF.function_declarator,e_.RIGHT_PAREN]],eu.FunctionProtoType.pool),ej.createProductionWithOptions(eF.function_declarator,[[eF.function_header],[eF.function_header,eF.function_parameter_list]],eu.FunctionDeclarator.pool),ej.createProductionWithOptions(eF.function_header,[[eF.fully_specified_type,e_.ID,e_.LEFT_PAREN]],eu.FunctionHeader.pool),ej.createProductionWithOptions(eF.function_parameter_list,[[eF.parameter_declaration],[eF.function_parameter_list,e_.COMMA,eF.parameter_declaration]],eu.FunctionParameterList.pool),ej.createProductionWithOptions(eF.parameter_declaration,[[eF.type_qualifier,eF.parameter_declarator],[eF.parameter_declarator]],eu.ParameterDeclaration.pool),ej.createProductionWithOptions(eF.parameter_declarator,[[eF.type_specifier,e_.ID],[eF.type_specifier,e_.ID,eF.array_specifier]],eu.ParameterDeclarator.pool),ej.createProductionWithOptions(eF.statement_list,[[eF.statement],[eF.statement_list,eF.statement]],eu.StatementList.pool),ej.createProductionWithOptions(eF.statement,[[eF.compound_statement],[eF.simple_statement]]),ej.createProductionWithOptions(eF.compound_statement_no_scope,[[e_.LEFT_BRACE,e_.RIGHT_BRACE],[e_.LEFT_BRACE,eF.statement_list,e_.RIGHT_BRACE]],eu.CompoundStatementNoScope.pool),ej.createProductionWithOptions(eF.compound_statement,[[e_.LEFT_BRACE,e_.RIGHT_BRACE],[eF.scope_brace,eF.statement_list,eF.scope_end_brace]]),ej.createProductionWithOptions(eF.simple_statement,[[eF.declaration],[eF.expression_statement],[eF.selection_statement],[eF.iteration_statement],[eF.jump_statement]]),ej.createProductionWithOptions(eF.declaration,[[eF.function_prototype,e_.SEMICOLON],[eF.init_declarator_list,e_.SEMICOLON],[eh.PRECISION,eF.precision_qualifier,eF.ext_builtin_type_specifier_nonarray,e_.SEMICOLON],[eF.type_qualifier,e_.ID,e_.SEMICOLON],[eF.type_qualifier,e_.ID,eF.identifier_list,e_.SEMICOLON]],eu.Declaration.pool),ej.createProductionWithOptions(eF.identifier_list,[[e_.COMMA,e_.ID],[eF.identifier_list,e_.COMMA,e_.ID]],eu.IdentifierList.pool),ej.createProductionWithOptions(eF.init_declarator_list,[[eF.single_declaration],[eF.init_declarator_list,e_.COMMA,e_.ID],[eF.init_declarator_list,e_.COMMA,e_.ID,eF.array_specifier],[eF.init_declarator_list,e_.COMMA,e_.ID,eF.array_specifier,e_.EQUAL,eF.initializer],[eF.init_declarator_list,e_.COMMA,e_.ID,e_.EQUAL,eF.initializer]],eu.InitDeclaratorList.pool),ej.createProductionWithOptions(eF.single_declaration,[[eF.fully_specified_type,e_.ID],[eF.fully_specified_type,e_.ID,eF.array_specifier],[eF.fully_specified_type,e_.ID,eF.array_specifier,e_.EQUAL,eF.initializer],[eF.fully_specified_type,e_.ID,e_.EQUAL,eF.initializer]],eu.SingleDeclaration.pool),ej.createProductionWithOptions(eF.initializer,[[eF.assignment_expression],[e_.LEFT_BRACE,eF.initializer_list,e_.RIGHT_BRACE]]),ej.createProductionWithOptions(eF.initializer_list,[[eF.initializer],[eF.initializer_list,e_.COMMA,eF.initializer]]),ej.createProductionWithOptions(eF.expression_statement,[[e_.SEMICOLON],[eF.expression,e_.SEMICOLON]]),ej.createProductionWithOptions(eF.selection_statement,[[eh.IF,e_.LEFT_PAREN,eF.expression,e_.RIGHT_PAREN,eF.statement],[eh.IF,e_.LEFT_PAREN,eF.expression,e_.RIGHT_PAREN,eF.statement,eh.ELSE,eF.statement]]),ej.createProductionWithOptions(eF.iteration_statement,[[eh.WHILE,e_.LEFT_PAREN,eF.condition,e_.RIGHT_PAREN,eF.statement],[eh.FOR,e_.LEFT_PAREN,eF.for_init_statement,eF.for_rest_statement,e_.RIGHT_PAREN,eF.statement]]),ej.createProductionWithOptions(eF.precision_specifier,[[eh.PRECISION,eF.precision_qualifier,eF.ext_builtin_type_specifier_nonarray,e_.SEMICOLON]],eu.PrecisionSpecifier.pool),ej.createProductionWithOptions(eF.for_init_statement,[[eF.expression_statement],[eF.declaration]]),ej.createProductionWithOptions(eF.condition,[[eF.expression],[eF.fully_specified_type,e_.ID,e_.EQUAL,eF.initializer]]),ej.createProductionWithOptions(eF.for_rest_statement,[[eF.conditionopt,e_.SEMICOLON],[eF.conditionopt,e_.SEMICOLON,eF.expression]]),ej.createProductionWithOptions(eF.conditionopt,[[e_.EPSILON],[eF.condition]]),ej.createProductionWithOptions(eF.jump_statement,[[eh.CONTINUE,e_.SEMICOLON],[eh.BREAK,e_.SEMICOLON],[eh.RETURN,e_.SEMICOLON],[eh.RETURN,eF.expression,e_.SEMICOLON],[eh.DISCARD,e_.SEMICOLON]],eu.JumpStatement.pool),ej.createProductionWithOptions(eF.scope_brace,[[e_.LEFT_BRACE]],eu.ScopeBrace.pool),ej.createProductionWithOptions(eF.scope_end_brace,[[e_.RIGHT_BRACE]],eu.ScopeEndBrace.pool),ej.createProductionWithOptions(eF.variable_identifier,[[e_.ID]],eu.VariableIdentifier.pool)),ez=function(e){for(var t=0;t<eq.length;t++){var n=eq[t][1];n&&e.addTranslationRule(t,n)}},eQ=/*#__PURE__*/function(){function e(t,n,i){this._needReInfer=!0,this.production=t,this.position=n,this.lookaheadSet=new Set;for(var a,o=r(i);!(a=o()).done;){var s=a.value;this.lookaheadSet.add(s)}this.id=e._id++}var t=e.prototype;return t.addLookahead=function(e){for(var t,n=r(e);!(t=n()).done;){var i=t.value;this.lookaheadSet.has(i)||(this.lookaheadSet.add(i),this.needReInfer=!0)}},t.symbolByOffset=function(e){return this.production.derivation[this.position+e]},t.canReduce=function(){if(this.position>this.production.derivation.length-1)return!0;for(var e=this.position;e<this.production.derivation.length;e++)if(this.production.derivation[e]!==e_.EPSILON)return!1;return!0},t.advance=function(){return new e(this.production,this.position+1,this.lookaheadSet)},ex(e,[{key:"needReInfer",get:function(){return this._needReInfer},set:function(e){this._needReInfer=e}},{key:"curSymbol",get:function(){return this.production.derivation[this.position]}},{key:"nextSymbol",get:function(){return this.production.derivation[this.position+1]}}]),e}();eQ._id=0;var eX=/*#__PURE__*/function(){function e(t){this.closured=!1,this._stateItemPool=new Map,this.id=e._id++,this._items=new Set([].concat(t)),this.cores=new Set([].concat(t));for(var n,i=r(t);!(n=i()).done;){var a=n.value,o=this.getStateItemMapKey(a.production,a.position);this._stateItemPool.set(o,a)}e.pool.set(this.id,this)}var t=e.prototype;return t.getStateItemMapKey=function(e,t){return e.id+","+t},t.createStateItem=function(e,t,n){void 0===n&&(n=new Set);var i=this.getStateItemMapKey(e,t),a=this._stateItemPool.get(i);if(a){for(var o,s=r(n);!(o=s()).done;){var c=o.value;a.lookaheadSet.has(c)||(a.lookaheadSet.add(c),a.needReInfer=!0)}return a}var u=new eQ(e,t,n);return this._stateItemPool.set(i,u),u},e.create=function(t){var n=this.getMapKey(t),i=this.closureMap.get(n);if(i){for(var a,o=r(t);!(a=o()).done;){var s=a.value;i.createStateItem(s.production,s.position,s.lookaheadSet)}return i}var c=new e(t);return this.closureMap.set(n,c),c},e.getMapKey=function(e){return e.map(function(e){return e.production.id+","+e.position}).join(";")},ex(e,[{key:"items",get:function(){return this._items}},{key:"needReInfer",get:function(){for(var e,t=r(this.cores);!(e=t()).done;)if(e.value.needReInfer)return!0;return!1}}]),e}();eX.closureMap=new Map,eX.pool=new Map,eX._id=0;var eK=/*#__PURE__*/function(){function e(e){this.firstSetMap=new Map,this.followSetMap=new Map,this.actionTable=new Map,this.gotoTable=new Map,this._firstSetNTStack=[],this.grammar=e}var t=e.prototype;return t.generate=function(){this.computeFirstSet(),this.buildStateTable()},t.buildStateTable=function(){var e=[new eQ(this.grammar.productions[0],0,[e_.EOF])],t=eX.create(e);this._extendState(t)},t._extendState=function(e){if(e.needReInfer){this._closure(e);for(var t,n=this._inferNextState(e),i=r(n);!(t=i()).done;){var a=t.value;this._extendState(a)}}},t._closure=function(e){for(var t,n=r(e.cores);!(t=n()).done;){var i=t.value;i.canReduce()||this._extendStateItem(e,i)}return e.closured=!0,e},t._extendStateItem=function(e,t){if(!ej.isTerminal(t.curSymbol)){var n=this.grammar.getProductionList(t.curSymbol);if(t.nextSymbol){for(var i=new Set,a=!1,o=1,s=t.symbolByOffset(1);s;s=t.symbolByOffset(++o)){if(ej.isTerminal(s)){i.add(s),a=!0;break}c=this.firstSetMap.get(s);for(var c,u,l=r(c);!(u=l()).done;){var p=u.value;i.add(p)}if(!c.has(e_.EPSILON))break}if(!a&&(null==c?void 0:c.has(e_.EPSILON)))for(var h,d=r(t.lookaheadSet);!(h=d()).done;){var _=h.value;i.add(_)}for(var f,S=r(n);!(f=S()).done;){var g=f.value,v=e.createStateItem(g,0);e.items.has(v)&&ej.isSubSet(i,v.lookaheadSet)||(e.items.add(v),v.addLookahead(i),this._extendStateItem(e,v))}}else for(var m,y=r(n);!(m=y()).done;){var x=m.value,E=e.createStateItem(x,0);e.items.has(E)&&ej.isSubSet(t.lookaheadSet,E.lookaheadSet)||(e.items.add(E),E.addLookahead(t.lookaheadSet),this._extendStateItem(e,E))}}},t._inferNextState=function(e){var t=new Map,n=null!=(a=this.actionTable.get(e.id))?a:new Map,i=null!=(o=this.gotoTable.get(e.id))?o:new Map;this.actionTable.set(e.id,n),this.gotoTable.set(e.id,i);for(var a,o,s,c=r(e.items);!(s=c()).done;){var u=s.value;if(u.canReduce()){var l=void 0;l=u.production.goal!==eF.START?{action:eb.Reduce,target:u.production.id}:{action:eb.Accept};for(var p,h=r(u.lookaheadSet);!(p=h()).done;){var d=p.value;this._addAction(n,d,l)}}else{var _=u.advance();ej.addMapSetItem(t,u.curSymbol,_)}u.needReInfer=!1}for(var f,S=new Set,g=r(t.entries());!(f=g()).done;){var v=f.value,m=v[0],y=v[1],x=eX.create(Array.from(y));ej.isTerminal(m)?this._addAction(n,m,{action:eb.Shift,target:x.id}):i.set(m,x.id),S.add(x)}return S},t._addAction=function(e,t,n){var r=e.get(t);(!r||ej.isActionEqual(r,n)||t!==eh.ELSE||r.action!==eb.Shift||n.action!==eb.Reduce)&&e.set(t,n)},t.computeFirstSet=function(){for(var e,t=r(this.grammar.productions.slice(1));!(e=t()).done;){var n=e.value;this._computeFirstSetForNT(n.goal)}},t._computeFirstSetForNT=function(e){var t=this._firstSetNTStack.findIndex(function(t){return t===e});if(-1!==t){for(var n=this.firstSetMap.get(e),i=this._firstSetNTStack.length,a=i-1;a>t;a--){var o=this._firstSetNTStack[a];this.firstSetMap.set(o,n)}return n}this._firstSetNTStack.push(e);var s=this.grammar.getProductionList(e),c=new Set;this.firstSetMap.set(e,c),this.grammar.isNullableNT(e)&&c.add(e_.EPSILON);for(var u,l=r(s);!(u=l()).done;){for(var p=u.value,h=0;h<p.derivation.length;h++){var d=p.derivation[h];if(ej.isTerminal(d)){c.add(d);break}for(var _,f=this._computeFirstSetForNT(d),S=r(f);!(_=S()).done;){var g=_.value;g!==e_.EPSILON&&c.add(g)}if(!this.grammar.isNullableNT(d))break}h===p.derivation.length&&c.add(e_.EPSILON)}return this._firstSetNTStack.pop(),c},e}(),eY=/*#__PURE__*/function(){function e(e,t,n){this._traceBackStack=[],this.actionTable=e,this.gotoTable=t,this.grammar=n,this.sematicAnalyzer=new eD}return e.prototype.parse=function(e){this.sematicAnalyzer.reset();var n=performance.now(),r=this._traceBackStack,i=this.sematicAnalyzer;r.push(0);for(var a=e.next(),o=0;;){o+=1;var s=a.value,c=this.stateActionTable.get(s.type);if((null==c?void 0:c.action)===eb.Shift)r.push(s,c.target),a=e.next();else{if((null==c?void 0:c.action)===eb.Accept)return t.Logger.info("[pass compilation - parser] Accept! State automata run "+o+" times! cost time "+(performance.now()-n)+"ms"),null==i.acceptRule||i.acceptRule.call(i,i),i.semanticStack.pop();if((null==c?void 0:c.action)!==eb.Reduce)return eS.createGSError("Unexpected token "+s.lexeme,eE.CompilationError,t_._processingPassText,s.location),null;for(var u=c.target,l=this.grammar.getProductionByID(u),p=i.getTranslationRule(l.id),h=[],d=l.derivation.length-1;d>=0;d--)if(l.derivation[d]!==e_.EPSILON){r.pop();var _=r.pop();if(ef(_,eg))h.unshift(_);else{var f=i.semanticStack.pop();h.unshift(f)}}null==p||p.apply(void 0,[].concat([i],h));var S=this.stateGotoTable;r.push(l.goal);var g=null==S?void 0:S.get(l.goal);r.push(g);continue}}},e.create=function(){if(!this._singleton){var t=ew.create(eF.gs_shader_program,eq.map(function(e){return e[0]})),n=new eK(t);n.generate(),this._singleton=new e(n.actionTable,n.gotoTable,t),ez(this._singleton.sematicAnalyzer)}return this._singleton},ex(e,[{key:"curState",get:function(){return this._traceBackStack[this._traceBackStack.length-1]}},{key:"stateActionTable",get:function(){return this.actionTable.get(this.curState)}},{key:"stateGotoTable",get:function(){return this.gotoTable.get(this.curState)}}]),e}();function eJ(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var e$=/*#__PURE__*/function(){function e(e,t,n,r){this.macro=e,this.body=t,this.location=n,this.args=r,r&&(this._argsLexemes=this.args.map(function(e){return e.lexeme}),this._replaceRegex=RegExp("\\b("+this._argsLexemes.join("|")+")\\b","g"))}return e.prototype.expandFunctionBody=function(e){var t,n=this;if(e.length!==(null==(t=this.args)?void 0:t.length))throw eS.createGSError("mismatched function macro",GSErrorName.PreprocessorError,"",this.location);return this.body.lexeme.replace(this._replaceRegex,function(t){return e[n._argsLexemes.indexOf(t)]})},ex(e,[{key:"isFunction",get:function(){var e;return!!(null==(e=this.args)?void 0:e.length)}}]),e}(),eZ=((eo={})[eo.id=0]="id",eo[eo.line_remain=1]="line_remain",eo[eo.chunk=2]="chunk",eo[eo.int_constant=3]="int_constant",eo[eo.string_const=4]="string_const",eo[eo.right_op=5]="right_op",eo[eo.left_op=6]="left_op",eo[eo.left_paren=7]="left_paren",eo[eo.right_paren=8]="right_paren",eo[eo.ge=9]="ge",eo[eo.le=10]="le",eo[eo.eq=11]="eq",eo[eo.neq=12]="neq",eo[eo.and=13]="and",eo[eo.or=14]="or",eo[eo.left_angle=15]="left_angle",eo[eo.right_angle=16]="right_angle",eo[eo.star=17]="star",eo[eo.plus=18]="plus",eo[eo.dash=19]="dash",eo[eo.bang=20]="bang",eo[eo.slash=21]="slash",eo[eo.percent=22]="percent",eo[eo.EOF=100]="EOF",eo),e0=((es={})[es.define=101]="define",es[es.undef=102]="undef",es[es.if=103]="if",es[es.ifdef=104]="ifdef",es[es.ifndef=105]="ifndef",es[es.else=106]="else",es[es.elif=107]="elif",es[es.endif=108]="endif",es[es.include=109]="include",es[es.defined=110]="defined",es),e1=new Map([["#define",101],["#undef",102],["#if",103],["#ifdef",104],["#ifndef",105],["#else",106],["#elif",107],["#endif",108],["#include",109],["defined",110]]),e2=/*#__PURE__*/function(){function e(){}return e.expand=function(e,t){for(var n,i=[],a=0,o=0,s=r(e);!(n=s()).done;){var c=n.value,u=t.slice(a,c.rangeInBlock.start.index);i.push(u,c.replace);var l=o+u.length+c.replace.length;a=c.rangeInBlock.end.index,o=l}return i.push(t.slice(a)),i.join("")},e.assembleSegments=function(e,t){for(var n,i=[],a=0,o=r(e);!(n=o()).done;){var s=n.value,c=t.slice(a,s.range.start.index);i.push(c,s.replace),a=s.range.end.index}return i.push(t.slice(a)),i.join("")},e}(),e3=/*#__PURE__*/function(e){function t(t){var n;return(n=e.call(this,t)||this).macroLvl=0,n}a(t,e);var n=t.prototype;return n.scanDirective=function(e){var t=this._advanceToDirective(e);return[e0.if,e0.ifdef,e0.ifndef].includes(null==t?void 0:t.type)?this.macroLvl+=1:(null==t?void 0:t.type)===e0.endif&&(this.macroLvl-=1),t},n.scanWordsUntilChar=function(e){for(var t=[];;)if(this.skipSpace(!0),em.isLetter(this.getCurCharCode()))t.push(this.scanWord());else{if(this.getCurChar()===e)return this._advance(),t;this._advance()}},n.scanWord=function(e){if(void 0===e&&(e=!1),e)for(;!em.isLetter(this.getCurCharCode())&&!this.isEnd();)this._advance();else this.skipSpace(!0);if(this.isEnd())return ev;for(var t=this._currentIndex;em.isLetter(this.getCurCharCode())&&!this.isEnd();)this._advance();var n=this._currentIndex,r=this._source.slice(t,n);n===t&&this.throwError(this.getShaderPosition(0),"no word found.");var i=e1.get(r);if(i){var a=eg.pool.get();return a.set(i,r,this.getShaderPosition(0)),a}var o=eg.pool.get();return o.set(eZ.id,r,this.getShaderPosition(r.length)),o},n.getShaderPosition=function(e){return t_.createPosition(this._currentIndex-e)},n.scanToken=function(e){if(this.skipCommentsAndSpace(),!this.isEnd()){for(var t=this._source,n=this._currentIndex,r=!1,i=t.length;this._currentIndex<i;)if(em.isPpCharactors(t.charCodeAt(this._currentIndex)))this._advance(),r=!0;else{if(r)break;this._advance(),this.skipCommentsAndSpace(),n=this._currentIndex}var a=t.slice(n,this._currentIndex),o=eg.pool.get(),s=e1.get(a);return o.set(null!=s?s:eZ.id,a,this.getShaderPosition(this._currentIndex-n)),null==e||e(o,this),o}},n.scanQuotedString=function(){this.skipSpace(!0),'"'!==this.getCurChar()&&this.throwError(this.getShaderPosition(0),"unexpected char, expected '\"'");var e=this.getShaderPosition(0);this._advance();for(var t=this._currentIndex;'"'!==this.getCurChar()&&!this.isEnd();)this._advance();this.isEnd()&&this.throwError(this.getShaderPosition(0),"unexpected char, expected '\"'");var n=this._source.slice(t,this._currentIndex),r=eg.pool.get();return r.set(eZ.string_const,n,e),r},n.scanToChar=function(e){for(var t=this._source;t[this._currentIndex]!==e&&!this.isEnd();)this._advance()},n.scanMacroBranchChunk=function(){for(var e=this._currentIndex,t=this.getShaderPosition(0),n=this.macroLvl,r=this.scanDirective();(r.type!==e0.endif||n-1!==this.macroLvl)&&(![e0.elif,e0.else].includes(r.type)||n!==this.macroLvl);)r=this.scanDirective();var i=this._source.slice(e,this._currentIndex-r.lexeme.length-1),a=eg.pool.get();return a.set(eZ.chunk,i,t),{token:a,nextDirective:r}},n.scanPairedBlock=function(e,t){this.scanToChar(e);var n=0,r=this._source;do{var i=r[this._currentIndex];i===e?n++:i===t&&n--,this._advance()}while(n>0)},n.scanRemainMacro=function(){for(var e=this.macroLvl,t=this.scanDirective();!this.isEnd()&&(t.type!==e0.endif||e-1!==this.macroLvl);)t=this.scanDirective();return this.getShaderPosition(0)},n.peekNonSpace=function(){for(var e=this._currentIndex;/\s/.test(this._source[e]);)e+=1;return this._source[e]},n.scanInteger=function(){for(var e=this._currentIndex;em.isNum(this.getCurCharCode());)this._advance();this._currentIndex===e&&this.throwError(this.getShaderPosition(0),"no integer found");var t=this._source.slice(e,this._currentIndex),n=eg.pool.get();return n.set(eZ.int_constant,t,this.getShaderPosition(0)),n},n.scanLineRemain=function(){this.skipSpace(!1);for(var e=this._currentIndex,t=[];"\n"!==this.getCurChar();){if(this.isEnd()){var n=this._source.slice(e,this._currentIndex),r=eg.pool.get();return r.set(eZ.line_remain,n,this.getShaderPosition(n.length)),r}this._advance();var i=this._skipComments();i&&(i.start.index-=e,i.end.index-=e,t.push(i))}var a=this._source.slice(e,this._currentIndex);t.length&&(a=e2.assembleSegments(t.map(function(e){return{range:e,replace:""}}),a));var o=eg.pool.get();return o.set(eZ.line_remain,a,this.getShaderPosition(a.length)),o},n._advanceToDirective=function(e){for(;;){var t=this.scanToken(e);if(null==t?void 0:t.lexeme.startsWith("#"))return t;if(this.isEnd())return}},n._skipComments=function(){if("//"===this.peek(2)){for(var e=this.getShaderPosition(0);"\n"!==this.getCurChar()&&!this.isEnd();)this._advance();return t_.createRange(e,this.getCurPosition())}if("/*"===this.peek(2)){var t=this.getShaderPosition(0);for(this.advance(2);"*/"!==this.peek(2)&&!this.isEnd();)this._advance();return this.advance(2),t_.createRange(t,this.getShaderPosition(0))}},t}(eT),e4=/*#__PURE__*/function(){function e(){}return e.reset=function(e,t){this._definedMacros.clear(),this._expandSegmentsStack.length=0,this._expandSegmentsStack.push([]),this._branchMacros.clear(),this.addPredefinedMacro("GL_ES"),this._includeMap=e,this._basePathForIncludeKey=t},e.addPredefinedMacro=function(e,t){var n,r=eg.pool.get();r.set(eZ.id,e),t&&(n=eg.pool.get()).set(eZ.id,t),this._definedMacros.set(e,new e$(r,n))},e.parse=function(e){for(;!e.isEnd();){var t=e.scanDirective(this._onToken.bind(this));if(e.isEnd())break;switch(t.type){case e0.define:this._parseDefine(e);break;case e0.undef:this._parseUndef(e);break;case e0.if:this._parseIf(e);break;case e0.ifndef:this._parseIfNdef(e);break;case e0.ifdef:this._parseIfDef(e);break;case e0.include:this._parseInclude(e)}}return e2.expand(this.expandSegments,e.source,e.sourceMap)},e.reportError=function(e,t,n,r){eS.createGSError(t,eE.PreprocessorError,n,e,r)},e._parseInclude=function(e){var n,r=e.getShaderPosition(8);e.skipSpace(!0);var i=e.scanQuotedString();n="."!==i.lexeme[0]?i.lexeme:new URL(i.lexeme,this._basePathForIncludeKey).href.substring(t.ShaderPass._shaderRootPath.length),e.scanToChar("\n");var a=e.getShaderPosition(0),o=this._includeMap[n];if(!o){this.reportError(i.location,'Shader slice "'+n+'" not founded.',e.source,e.file);return}var s=t_.createRange(r,a),c=this._expandMacroChunk(o,s,i.lexeme);this.expandSegments.push({rangeInBlock:s,replace:c.content})},e._parseIfDef=function(e){var t=e.current-6,n=e.scanWord();this._addEmptyReplace(e,t),this._branchMacros.add(n.lexeme);var r=this._definedMacros.get(n.lexeme);e.skipSpace(!0);var i=e.scanMacroBranchChunk(),a=i.token,o=i.nextDirective;if(r){var s=o.type===e0.endif?e.getShaderPosition(0):e.scanRemainMacro(),c=this._expandMacroChunk(a.lexeme,a.location,e),u=t_.createRange(a.location.start,s);this.expandSegments.push({rangeInBlock:u,replace:c.content});return}this.expandSegments.pop(),this._addEmptyReplace(e,t),this._parseMacroBranch(o.type,e)},e._parseMacroBranch=function(e,t){if(e!==e0.endif){var n=t.current;if(e===e0.else){var r=t.scanMacroBranchChunk().token,i=this._expandMacroChunk(r.lexeme,r.location,t),a=t_.createPosition(n),o=t_.createRange(a,t.getShaderPosition(0));this.expandSegments.push({rangeInBlock:o,replace:i.content})}else if(e===e0.elif){var s=this._parseConstantExpression(t),c=t.scanMacroBranchChunk(),u=c.token,l=c.nextDirective;if(s){var p=l.type===e0.endif?t.current:t.scanRemainMacro().index,h=this._expandMacroChunk(u.lexeme,u.location,t),d=t_.createPosition(n),_=t_.createPosition(p),f=t_.createRange(d,_);this.expandSegments.push({rangeInBlock:f,replace:h.content})}else{var S=t_.createPosition(n),g=t_.createPosition(t.current),v=t_.createRange(S,g);this.expandSegments.push({rangeInBlock:v,replace:""}),this._parseMacroBranch(l.type,t)}}}},e._parseConstantExpression=function(e){return e.skipSpace(!0),this._parseLogicalOrExpression(e)},e._parseLogicalOrExpression=function(e){var t=this._parseLogicalAndExpression(e),n=e.peek(2);if(n&&"||"===n){e.advance(2),e.skipSpace(!1);var r=this._parseLogicalOrExpression(e);return t||r}return t},e._parseLogicalAndExpression=function(e){var t=this._parseEqualityExpression(e),n=e.peek(2);if(n&&"&&"===n){e.advance(2),e.skipSpace(!1);var r=this._parseLogicalAndExpression(e);return t&&r}return t},e._parseEqualityExpression=function(e){var t=this._parseRelationalExpression(e),n=e.peek(2);if(n&&["==","!="].includes(n)){e.advance(2),e.skipSpace(!1);var r=this._parseEqualityExpression(e);switch(n){case"==":return t===r;case"!=":return t!==r}}return t},e._parseRelationalExpression=function(e){var t=this._parseShiftExpression(e),n=e.peek(2);if("="!==n[1]&&(n=n[0]),n&&[">","<",">=","<="].includes(n)){var r=e.getShaderPosition(0);e.advance(n.length),e.skipSpace(!1);var i=this._parseRelationalExpression(e);if((void 0===t?"undefined":eJ(t))!==(void 0===i?"undefined":eJ(i))&&"number"!=typeof t){this.reportError(r,"invalid operator in relation expression.",e.source,e.file);return}switch(n){case">":return t>i;case"<":return t<i;case">=":return t>=i;case"<=":return t<=i}}return t},e._parseShiftExpression=function(e){var t=this._parseAdditiveExpression(e),n=e.peek(2);if(n&&[">>","<<"].includes(n)){var r=e.getShaderPosition(0);e.advance(2),e.skipSpace(!1);var i=this._parseShiftExpression(e);if((void 0===t?"undefined":eJ(t))!==(void 0===i?"undefined":eJ(i))&&"number"!=typeof t){this.reportError(r,"invalid operator in shift expression.",e.source,e.file);return}switch(n){case">>":return t>>i;case"<<":return t<<i}}return t},e._parseAdditiveExpression=function(e){var t=this._parseMulticativeExpression(e);if([">","<"].includes(e.getCurChar())){var n=e.getShaderPosition(0);e.advance();var r=e.getCurChar();e.skipSpace(!1);var i=this._parseAdditiveExpression(e);if((void 0===t?"undefined":eJ(t))!==(void 0===i?"undefined":eJ(i))&&"number"!=typeof t)return this.reportError(n,"invalid operator.",e.source,e.file),!1;switch(r){case"+":return t+i;case"-":return t-i}}return t},e._parseMulticativeExpression=function(e){var t=this._parseUnaryExpression(e);if(e.skipSpace(!1),["*","/","%"].includes(e.getCurChar())){var n=e.getShaderPosition(0),r=e.getCurChar();e.skipSpace(!1);var i=this._parseMulticativeExpression(e);if((void 0===t?"undefined":eJ(t))!==(void 0===i?"undefined":eJ(i))&&"number"!=typeof t){this.reportError(n,"invalid operator.",e.source,e.file);return}switch(r){case"*":return t*i;case"/":return t/i;case"%":return t%i}}return t},e._parseUnaryExpression=function(e){var t=e.getCurChar();if(["+","-","!"].includes(t)){e.advance();var n=e.getShaderPosition(0),r=this._parseParenthesisExpression(e);switch(("!"===t&&"boolean"!=typeof r||"!"!==t&&"number"!=typeof r)&&this.reportError(n,"invalid operator.",e.source,e.file),t){case"+":return r;case"-":return-r;case"!":return!r}}return this._parseParenthesisExpression(e)},e._parseParenthesisExpression=function(e){if("("===e.getCurChar()){e._advance(),e.skipSpace(!1);var t=this._parseConstantExpression(e);return e.scanToChar(")"),e._advance(),t}return this._parseConstant(e)},e._parseConstant=function(e){if(em.isAlpha(e.getCurCharCode())){var t=e.scanWord();if(t.type===e0.defined){var n="("===e.peekNonSpace(),r=e.scanWord(!0);return n&&(e.scanToChar(")"),e._advance()),this._branchMacros.add(r.lexeme),!!this._definedMacros.get(r.lexeme)}var i=this._definedMacros.get(t.lexeme);if(!i||!i.body)return!1;i.isFunction&&this.reportError(t.location,"invalid function macro usage",e.source,e.file);var a=Number(i.body.lexeme);return Number.isInteger(a)||this.reportError(t.location,"invalid const macro: "+t.lexeme,e.source,e.file),this._branchMacros.add(t.lexeme),a}if(em.isNum(e.getCurCharCode()))return Number(e.scanInteger().lexeme);this.reportError(e.getShaderPosition(0),"invalid token: "+e.getCurChar(),e.source,e.file)},e._expandMacroChunk=function(e,t,n){this._expandSegmentsStack.push([]),r="string"==typeof n?new e3(e,n):new e3(e,n.file,t);var r,i=this.parse(r);return this._expandSegmentsStack.pop(),{content:i}},e._parseIfNdef=function(e){var t=e.current-7,n=e.scanWord();this._addEmptyReplace(e,t),this._branchMacros.add(n.lexeme);var r=this._definedMacros.get(n.lexeme),i=e.scanMacroBranchChunk(),a=i.token,o=i.nextDirective;if(!r){var s=o.type===e0.endif?e.getShaderPosition(0):e.scanRemainMacro(),c=this._expandMacroChunk(a.lexeme,a.location,e),u=t_.createRange(a.location.start,s);this.expandSegments.push({rangeInBlock:u,replace:c.content});return}this.expandSegments.pop(),this._addEmptyReplace(e,t),this._parseMacroBranch(o.type,e)},e._addEmptyReplace=function(e,t){var n=t_.createPosition(t),r=e.getCurPosition(),i=t_.createRange(n,r);this.expandSegments.push({rangeInBlock:i,replace:""})},e._parseIf=function(e){var t=e.current-3,n=this._parseConstantExpression(e);this._addEmptyReplace(e,t);var r=e.scanMacroBranchChunk(),i=r.token,a=r.nextDirective;if(n){var o=a.type===e0.endif?e.getShaderPosition(0):e.scanRemainMacro(),s=this._expandMacroChunk(i.lexeme,i.location,e),c=t_.createRange(i.location.start,o);this.expandSegments.push({rangeInBlock:c,replace:s.content});return}this.expandSegments.pop(),this._addEmptyReplace(e,t),this._parseMacroBranch(a.type,e)},e._parseDefine=function(e){var t,n=e.getShaderPosition(7),r=e.scanWord(),i=r.location.end;this._definedMacros.get(r.lexeme)&&r.lexeme.startsWith("GL_")&&this.reportError(r.location,"redefined macro: "+r.lexeme,e.source,e.file),"("===e.getCurChar()&&(t=e.scanWordsUntilChar(")"),i=e.getShaderPosition(0));var a=new e$(r,e.scanLineRemain(),t_.createRange(n,i),t);this._definedMacros.set(r.lexeme,a),this.expandSegments.push({rangeInBlock:t_.createRange(n,e.getCurPosition()),replace:""})},e._parseUndef=function(e){var t=e.current-6,n=e.scanWord(),r=t_.createPosition(t),i=t_.createRange(r,e.getCurPosition());this.expandSegments.push({rangeInBlock:i,replace:""}),this._definedMacros.delete(n.lexeme)},e._onToken=function(e,t){var n=this._definedMacros.get(e.lexeme);if(n){var r=n.body.lexeme;if(n.isFunction){t.scanToChar("("),t._advance();for(var i=[],a=1,o=t.current;;){if("("===t.getCurChar())a+=1;else if(")"===t.getCurChar()){if(0==(a-=1))break}else","===t.getCurChar()&&1===a&&(i.push(t.source.slice(o,t.current)),o=t.current+1);t._advance()}i.push(t.source.slice(o,t.current)),t._advance();var s=t_.createRange(e.location.start,t.getCurPosition());r=n.expandFunctionBody(i);var c=this._expandMacroChunk(r,s,t),u=t_.createRange(e.location.start,t.getCurPosition());this.expandSegments.push({rangeInBlock:u,replace:c.content})}else{var l=this._expandMacroChunk(r,e.location,t),p=t_.createRange(e.location.start,e.location.end);this.expandSegments.push({rangeInBlock:p,replace:l.content})}}},ex(e,null,[{key:"expandSegments",get:function(){return this._expandSegmentsStack[this._expandSegmentsStack.length-1]}}]),e}();e4._definedMacros=new Map,e4._expandSegmentsStack=[[]],e4._branchMacros=new Set;var e9=/*#__PURE__*/function(){function e(){}return e.reset=function(e,t){e4.reset(e,t)},e.process=function(e){return this.baseScanner=new e3(e),e4.parse(this.baseScanner)},e.addPredefinedMacro=function(e,t){e4.addPredefinedMacro(e,t)},e}(),e5=/*#__PURE__*/function(){function e(){}return e.unwrapNodeByType=function(t,n){var r=t.children[0];if(!ef(r,eg))return r.nt===n?r:e.unwrapNodeByType(r,n)},e.isTerminal=function(e){return e<eF.START},e}(),e6=/*#__PURE__*/function(){function e(){this.attributeList=[],this.attributeStructs=[],this._referencedAttributeList=Object.create(null),this._referencedGlobals=Object.create(null),this._referencedVaryingList=Object.create(null),this._referencedMRTList=Object.create(null)}var t=e.prototype;return t.reset=function(){this.attributeList.length=0,this.attributeStructs.length=0,this._referencedAttributeList=Object.create(null),this._referencedGlobals=Object.create(null),this._referencedVaryingList=Object.create(null),this._referencedMRTList=Object.create(null),this.mrtStruct=void 0},t.isAttributeStruct=function(e){return -1!==this.attributeStructs.findIndex(function(t){return t.ident.lexeme===e})},t.isVaryingStruct=function(e){var t,n;return(null==(n=this.varyingStruct)?void 0:null==(t=n.ident)?void 0:t.lexeme)===e},t.isMRTStruct=function(e){var t,n;return(null==(n=this.mrtStruct)?void 0:null==(t=n.ident)?void 0:t.lexeme)===e},t.referenceAttribute=function(e){if(!this._referencedAttributeList[e.lexeme]){var t=this.attributeList.find(function(t){return t.ident.lexeme===e.lexeme});if(!t)return eS.createGSError("referenced attribute not found: "+e.lexeme,eE.CompilationError,t_._processingPassText,e.location);this._referencedAttributeList[e.lexeme]=t}},t.referenceVarying=function(e){if(!this._referencedVaryingList[e.lexeme]){var t,n=null==(t=this.varyingStruct)?void 0:t.propList.find(function(t){return t.ident.lexeme===e.lexeme});if(!n)return eS.createGSError("referenced varying not found: "+e.lexeme,eE.CompilationError,t_._processingPassText,e.location);this._referencedVaryingList[e.lexeme]=n}},t.referenceMRTProp=function(e){if(!this._referencedMRTList[e.lexeme]){var t,n=null==(t=this.mrtStruct)?void 0:t.propList.find(function(t){return t.ident.lexeme===e.lexeme});if(!n)return eS.createGSError("referenced mrt not found: "+e.lexeme,eE.CompilationError,t_._processingPassText,e.location);this._referencedMRTList[e.lexeme]=n}},t.referenceGlobal=function(e,t){if(!this._referencedGlobals[e]){if(t===eR.FN){for(var n=this._passSymbolTable.getAllFnSymbols(e),r=0;r<n.length;r++){var i=0===r?e:e+r;this._referencedGlobals[i]=n[r]}return}var a=this._passSymbolTable.lookup(e,t);a&&(this._referencedGlobals[e]=a)}},e.reset=function(){this._singleton||(this._singleton=new e),this._singleton.reset()},ex(e,[{key:"passSymbolTable",get:function(){return this._passSymbolTable}}],[{key:"context",get:function(){return this._singleton}}]),e}(),e7=/*#__PURE__*/function(){function e(){this.array=[]}return e.prototype.dispose=function(){this.array.length=0},e}(),e8="GS_glFragColor",te=/*#__PURE__*/function(){function e(){}var n=e.prototype;return n.defaultCodeGen=function(t){var n=e._tmpArrayPool,i=n.get();i.dispose();for(var a,o=r(t);!(a=o()).done;){var s=a.value;ef(s,eg)?i.array.push(s.lexeme):i.array.push(s.codeGen(this))}return n.return(i),i.array.join(" ")},n.visitPostfixExpression=function(e){var t=e.children,n=t.length,r=e6.context;if(3===n){var i=t[0],a=t[2];return ef(a,eg)?r.isAttributeStruct(i.type)?(r.referenceAttribute(a),a.lexeme):r.isVaryingStruct(i.type)?(r.referenceVarying(a),a.lexeme):r.isMRTStruct(i.type)?(r.referenceMRTProp(a),a.lexeme):i.codeGen(this)+"."+a.lexeme:i.codeGen(this)+"."+a.codeGen(this)}if(4===n){var o=t[0],s=t[2],c=o.codeGen(this),u=s.codeGen(this);if("gl_FragData"===c){var l=this.getFragDataCodeGen(u);return r._referencedMRTList[l]=this.getReferencedMRTPropText(u,l),l}return c+"["+u+"]"}return this.defaultCodeGen(e.children)},n.visitVariableIdentifier=function(e){return ef(e.symbolInfo,eM)&&e.symbolInfo.isGlobalVariable&&e6.context.referenceGlobal(e.lexeme,eR.VAR),e.lexeme},n.visitFunctionCall=function(e){var t=e.children[0];if(ef(t.fnSymbol,eO)){e6.context.referenceGlobal(t.fnSymbol.ident,eR.FN);var n=t.children[2],r=t.fnSymbol.astNode.protoType.parameterList;if(ef(n,eu.FunctionCallParameterList)){for(var i=[],a=n.paramNodes,o=0;o<a.length;o++)e6.context.isAttributeStruct(r[o].typeInfo.typeLexeme)||e6.context.isVaryingStruct(r[o].typeInfo.typeLexeme)||i.push(a[o].codeGen(this));return t.fnSymbol.ident+"("+i.join(", ")+")"}}return this.defaultCodeGen(e.children)},n.visitStatementList=function(e){var t=e.children;return 1===t.length?t[0].codeGen(this):t[0].codeGen(this)+"\n"+t[1].codeGen(this)},n.visitSingleDeclaration=function(e){var t=e.typeSpecifier.type;return"string"==typeof t&&e6.context.referenceGlobal(t,eR.STRUCT),this.defaultCodeGen(e.children)},n.visitGlobalVariableDeclaration=function(e){var t=e.children,n=t[0];return ef(n,eu.FullySpecifiedType)&&n.typeSpecifier.isCustom&&e6.context.referenceGlobal(n.type,eR.STRUCT),this.defaultCodeGen(t)},n.visitDeclaration=function(e){var t=e6.context,n=e.children,r=n[0];if(ef(r,eu.InitDeclaratorList)){var i=r.typeInfo.typeLexeme;if(t.isVaryingStruct(i)||t.isMRTStruct(i))return""}return this.defaultCodeGen(n)},n.visitFunctionProtoType=function(e){return e6.context._curFn=e,this.defaultCodeGen(e.children)},n.visitFunctionDefinition=function(e){return e6.context._curFn=void 0,this.defaultCodeGen(e.children)},n.visitFunctionParameterList=function(e){var t=this;return e.parameterInfoList.filter(function(e){return!e6.context.isAttributeStruct(e.typeInfo.typeLexeme)&&!e6.context.isVaryingStruct(e.typeInfo.typeLexeme)}).map(function(e){return e.astNode.codeGen(t)}).join(", ")},n.visitFunctionHeader=function(e){var t=e.returnType.typeSpecifier.lexeme;return e6.context.isAttributeStruct(t)||e6.context.isVaryingStruct(t)?"void "+e.ident.lexeme+"(":this.defaultCodeGen(e.children)},n.visitJumpStatement=function(e){var t=e.children;if(t[0].type===eh.RETURN){var n=t[1];if(ef(n,eu.Expression)){var r,i,a,o,s=e5.unwrapNodeByType(n,eF.variable_identifier);if((null==s?void 0:s.typeInfo)===(null==(i=e6.context.varyingStruct)?void 0:null==(r=i.ident)?void 0:r.lexeme))return"";var c=e5.unwrapNodeByType(n,eF.function_call);if((null==c?void 0:c.type)===(null==(o=e6.context.varyingStruct)?void 0:null==(a=o.ident)?void 0:a.lexeme))return""+n.codeGen(this)+";"}}return this.defaultCodeGen(t)},n.visitFunctionIdentifier=function(e){return this.defaultCodeGen(e.children)},n._reportError=function(e,n){t.Logger.error(n)},e}();te._tmpArrayPool=new t.ReturnableObjectPool(e7,10);var tt=((ec={})[ec.VERTEX=0]="VERTEX",ec[ec.FRAGMENT=1]="FRAGMENT",ec[ec.ALL=2]="ALL",ec),tn=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._versionText="",t._extensions="",t._globalCodeArray=[],t}a(t,e);var n=t.prototype;return n.visitShaderProgram=function(e,t,n){return e6.reset(),e6.context._passSymbolTable=e.shaderData.symbolTable,{vertex:this.vertexMain(t,e.shaderData),fragment:this._fragmentMain(n,e.shaderData)}},n.vertexMain=function(e,t){var n=t.symbolTable,i=n.lookup(e,eR.FN);if(!(null==i?void 0:i.astNode))throw"no entry function found: "+e;var a=i.astNode;e6.context.stage=tt.VERTEX;var o=a.protoType.returnType;if("string"==typeof o.type){var s=n.lookup(o.type,eR.STRUCT);s?e6.context.varyingStruct=s.astNode:this._reportError(o.location,"invalid varying struct: "+o.type)}else o.type!==eh.VOID&&this._reportError(o.location,"vertex main entry can only return struct or void.");var c=a.protoType.parameterList;if(null==c?void 0:c.length)for(var u,l=r(c);!(u=l()).done;){var p=u.value;if("string"==typeof p.typeInfo.type){var h=n.lookup(p.typeInfo.type,eR.STRUCT);if(!h){this._reportError(p.astNode.location,'Not found attribute struct "'+p.typeInfo.type+'".');continue}e6.context.attributeStructs.push(h.astNode);for(var d,_=r(h.astNode.propList);!(d=_()).done;){var f=d.value;e6.context.attributeList.push(f)}}else e6.context.attributeList.push(p)}var S=a.statements.codeGen(this),g=this._globalCodeArray;g.length=0,this._getGlobalText(t,g),this.getAttributeDeclare(g),this.getVaryingDeclare(g);var v=g.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return e6.context.reset(),this._versionText+"\n"+v+"\n\nvoid main() "+S},n._fragmentMain=function(e,t){var n=t.symbolTable,r=n.lookup(e,eR.FN);if(!(null==r?void 0:r.astNode))throw"no entry function found: "+e;var i=r.astNode,a=i.returnStatement;a&&(a.isFragReturnStatement=!0);var o=e6.context;o.stage=tt.FRAGMENT;var s=i.protoType.returnType,c=s.type,u=s.location;if("string"==typeof c){var l=n.lookup(c,eR.STRUCT);l?o.mrtStruct=l.astNode:this._reportError(u,"invalid mrt struct: "+c)}else c!==eh.VOID&&c!==eh.VEC4&&this._reportError(u,"fragment main entry can only return struct or vec4.");var p=i.statements.codeGen(this),h=this._globalCodeArray;h.length=0,this._getGlobalText(t,h),this.getVaryingDeclare(h),this.getMRTDeclare(h);var d=h.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return o.reset(),this._versionText+"\n"+this._extensions+"\n\n#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n#else\n precision mediump float;\n precision mediump int;\n#endif\n\n"+d+"\n\nvoid main() "+p},n._getGlobalText=function(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=new Set);var a=e6.context._referencedGlobals;if(n===Object.keys(a).length){for(var o,s=r(e.globalPrecisions);!(o=s()).done;){var c=o.value;t.push({text:c.codeGen(this),index:c.location.start.index})}return t}for(var u in n=Object.keys(a).length,a){var l=a[u];i.has(u)||(i.add(u),ef(l,eI)?l.symbolType===eR.VAR?t.push({text:"uniform "+l.astNode.codeGen(this),index:l.astNode.location.start.index}):t.push({text:l.astNode.codeGen(this),index:l.astNode.location.start.index}):t.push({text:l.codeGen(this),index:l.location.start.index}))}return this._getGlobalText(e,t,n,i)},t}(te),tr=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._versionText="#version 100",t._extensions=["GL_EXT_shader_texture_lod","GL_OES_standard_derivatives","GL_EXT_draw_buffers","GL_EXT_frag_depth"].map(function(e){return"#extension "+e+" : enable\n"}).join(""),t}a(t,e);var n=t.prototype;return n.getFragDataCodeGen=function(e){return"gl_FragData["+e+"]"},n.getReferencedMRTPropText=function(e,t){return""},n.getAttributeDeclare=function(e){for(var t,n=r(Object.values(e6.context._referencedAttributeList));!(t=n()).done;){var i=t.value;e.push({text:"attribute "+i.typeInfo.typeLexeme+" "+i.ident.lexeme+";",index:i.ident.location.start.index})}},n.getVaryingDeclare=function(e){for(var t,n=r(Object.values(e6.context._referencedVaryingList));!(t=n()).done;){var i=t.value;e.push({text:"varying "+i.typeInfo.typeLexeme+" "+i.ident.lexeme+";",index:i.ident.location.start.index})}},n.getMRTDeclare=function(e){},n.visitPostfixExpression=function(t){var n=t.children,r=n[0],i=e6.context;if(ef(r,eu.PostfixExpression)&&i.isMRTStruct(r.type)){var a=n[2],o=i.mrtStruct.propList.find(function(e){return e.ident.lexeme===a.lexeme});return o?"gl_FragData["+o.mrtIndex+"]":(this._reportError(a.location,"not found mrt property: "+a.lexeme),"")}return e.prototype.visitPostfixExpression.call(this,t)},n.visitJumpStatement=function(t){return t.isFragReturnStatement?"gl_FragColor = "+t.children[1].codeGen(this):e.prototype.visitJumpStatement.call(this,t)},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(tn),ti=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._versionText="#version 300 es",t}a(t,e);var n=t.prototype;return n.getFragDataCodeGen=function(e){return"GS_glFragData_"+e},n.getReferencedMRTPropText=function(e,t){return"layout(location = "+e+") out vec4 "+t+";"},n.getAttributeDeclare=function(e){for(var t,n=r(Object.values(e6.context._referencedAttributeList));!(t=n()).done;){var i=t.value;e.push({text:"in "+i.typeInfo.typeLexeme+" "+i.ident.lexeme+";",index:i.ident.location.start.index})}},n.getVaryingDeclare=function(e){for(var t=e6.context.stage===tt.FRAGMENT?"in":"out",n=Object.values(e6.context._referencedVaryingList),r=0;r<n.length;r++){var i,a=n[r];e.push({text:(null!=(i=a.qualifier)?i:t)+" "+a.typeInfo.typeLexeme+" "+a.ident.lexeme+";",index:a.ident.location.start.index})}},n.getMRTDeclare=function(e){var t=e6.context._referencedMRTList;for(var n in t){var r=t[n];"string"==typeof r?e.push({text:r,index:Number.MAX_SAFE_INTEGER}):e.push({text:this.getReferencedMRTPropText(r.mrtIndex,n),index:r.ident.location.start.index})}},n.visitFunctionIdentifier=function(e){var t=e.children;if(1!==t[0].children.length)return this.defaultCodeGen(t);var n=e.lexeme;if("texture2D"===e.ident||"textureCube"===e.ident)n="texture";else if("texture2DProj"===e.ident)n="textureProj";else if(e6.context.stage===tt.FRAGMENT)switch(e.ident){case"texture2DLodEXT":case"textureCubeLodEXT":n="textureLod";break;case"texture2DGradEXT":case"textureCubeGradEXT":n="textureGrad";break;case"texture2DProjLodEXT":n="textureProjLod";break;case"texture2DProjGradEXT":n="textureProjGrad";break;case"gl_FragDepthEXT":n="gl_FragDepth"}return n},n.visitVariableIdentifier=function(t){return e6.context.stage===tt.FRAGMENT&&"gl_FragColor"===t.lexeme?(this._registerFragColorVariable(t),e8):e.prototype.visitVariableIdentifier.call(this,t)},n.visitJumpStatement=function(t){return t.isFragReturnStatement?e6.context.mrtStruct?"":(this._registerFragColorVariable(t),e8+" = "+t.children[1].codeGen(this)+";"):e.prototype.visitJumpStatement.call(this,t)},n._registerFragColorVariable=function(e){var t=e6.context._referencedVaryingList;if(!t[e8]){var n=eg.pool.get();n.set(e_.ID,e8,t_.createPosition(0,0,0)),t[e8]={ident:n,typeInfo:new eU(eh.VEC4,"vec4"),qualifier:"out",astNode:e}}},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(tn);function ta(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ta=function(){return!!e})()}function to(e,t,n){return(to=ta()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&i(a,n.prototype),a}).apply(null,arguments)}function ts(){return(ts=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var tc=new Map([["RenderQueueType",eh.GS_RenderQueueType],["BlendState",eh.GS_BlendState],["DepthState",eh.GS_DepthState],["StencilState",eh.GS_StencilState],["RasterState",eh.GS_RasterState],["EditorProperties",eh.GS_EditorProperties],["EditorMacros",eh.GS_EditorMacros],["Editor",eh.GS_Editor],["Tags",eh.GS_Tags],["VertexShader",eh.GS_VertexShader],["FragmentShader",eh.GS_FragmentShader],["SubShader",eh.GS_SubShader],["Pass",eh.GS_Pass],["BlendFactor",eh.GS_BlendFactor],["BlendOperation",eh.GS_BlendOperation],["Bool",eh.GS_Bool],["Number",eh.GS_Number],["CompareFunction",eh.GS_CompareFunction],["StencilOperation",eh.GS_StencilOperation],["CullMode",eh.GS_CullMode],["true",eh.TRUE],["false",eh.FALSE],["UsePass",eh.GS_UsePass],["Color",eh.GS_Color]]),tu=/*#__PURE__*/function(e){function t(t,n){return void 0===n&&(n=new Map),e.call(this,t,n)||this}a(t,e);var n=t.prototype;return n.scanWord=function(){this.skipCommentsAndSpace();for(var e=this._currentIndex;/\S/.test(this.getCurChar())&&!this.isEnd();)this._advance();return this._source.substring(e,this._currentIndex)},n.scanNumber=function(){this.skipCommentsAndSpace();for(var e=this._currentIndex;/[0-9]/.test(this.getCurChar());)this._advance();if("."===this.getCurChar())for(this._advance();/[0-9]/.test(this.getCurChar());)this._advance();return Number(this._source.substring(e,this._currentIndex))},t}(eT),tl=/*#__PURE__*/function(e){function n(){return e.apply(this,arguments)||this}a(n,e);var r=n.prototype;return r.insert=function(e){for(var n,r=null!=(n=this._table.get(e.ident))?n:[],i=0;i<r.length;i++)if(r[i].type===e.type){t.Logger.warn("replace symbol:",e.ident),r[i]=e;return}r.push(e),this._table.set(e.ident,r)},r.lookup=function(e,t){var n=this._table.get(e);if(n)for(var r=n.length,i=0;i<r;i++){var a=n[i];if(a.type===t)return a}},n}(ek),tp=[eh.GS_RenderQueueType,eh.GS_BlendFactor,eh.GS_BlendOperation,eh.GS_Bool,eh.GS_Number,eh.GS_Color,eh.GS_CompareFunction,eh.GS_StencilOperation,eh.GS_CullMode],th=[eh.GS_BlendState,eh.GS_DepthState,eh.GS_RasterState,eh.GS_StencilState],td=/*#__PURE__*/function(){function e(){}return e.reset=function(){this._errors.length=0,this._symbolTableStack.clear(),this._newScope()},e.parse=function(e){var n=performance.now(),r=new tu(e,tc),i={subShaders:[],globalContents:[],renderStates:{constantMap:{},variableMap:{}}};r.scanText("Shader"),i.name=r.scanPairedText('"','"'),r.scanText("{"),r.skipCommentsAndSpace(),this._parseShaderStatements(i,r);for(var a=i.globalContents,o=i.renderStates,s=0;s<i.subShaders.length;s++)for(var c=i.subShaders[s],u=a.concat(c.globalContents),l=ts({},o.constantMap,c.renderStates.constantMap),p=ts({},o.variableMap,c.renderStates.variableMap),h=0;h<c.passes.length;h++){var d=c.passes[h];if(Object.assign(d.renderStates.constantMap,l),Object.assign(d.renderStates.variableMap,p),!d.isUsePass){var _=u.concat(d.globalContents);d.contents=_.map(function(e){return e.content}).join("\n")}}return t.Logger.info("[content compilation] cost time "+(performance.now()-n)+"ms"),i},e._isRenderStateDeclarator=function(e){return th.includes(e.type)},e._isEngineType=function(e){return tp.includes(e.type)},e._lookupSymbolByType=function(t,n){for(var r=e._symbolTableStack.stack,i=r.length,a=i-1;a>=0;a--){var o=r[a].lookup(t,n);if(o)return o}},e._parseShaderStatements=function(t,n){for(var r=1,i=n.getCurPosition();;){var a=n.scanToken();switch(a.type){case eh.GS_SubShader:this._addGlobalStatement(t,n,i,a.lexeme.length);var o=this._parseSubShader(n);t.subShaders.push(o),i=n.getCurPosition();break;case eh.GS_EditorProperties:case eh.GS_EditorMacros:case eh.GS_Editor:this._addGlobalStatement(t,n,i,a.lexeme.length),n.scanPairedText("{","}",!0),i=n.getCurPosition();break;case eh.GS_RenderQueueType:this._addGlobalStatement(t,n,i,a.lexeme.length),this._parseRenderQueueAssignment(t,n),i=n.getCurPosition();break;case e_.NOT_WORD:if("{"===a.lexeme)r+=1;else if("}"===a.lexeme&&0==(r-=1)){this._addGlobalStatement(t,n,i,a.lexeme.length),this._symbolTableStack.dropScope();return}default:if(e._isRenderStateDeclarator(a)){this._addGlobalStatement(t,n,i,a.lexeme.length),this._parseRenderStateDeclarationOrAssignment(t,a,n),i=n.getCurPosition();break}e._isEngineType(a)&&(this._addGlobalStatement(t,n,i,a.lexeme.length),this._parseVariableDeclaration(a.type,n),i=n.getCurPosition())}}},e._parseRenderStateDeclarationOrAssignment=function(t,n,r){var i,a=r.scanToken();if(a.type===e_.ID)i=!0,r.scanText("{");else if("{"===a.lexeme)i=!1;else if("="===a.lexeme){var o=r.scanToken();r.scanText(";");var s=e._lookupSymbolByType(o.lexeme,n.type);(null==s?void 0:s.value)||eS.createGSError('Invalid "'+n.lexeme+'" variable: '+o.lexeme,eE.CompilationError,r.source,o.location);var c=s.value;Object.assign(t.renderStates.constantMap,c.constantMap),Object.assign(t.renderStates.variableMap,c.variableMap);return}var u=this._parseRenderStatePropList(n.lexeme,r);i?this._symbolTableStack.insert({ident:a.lexeme,type:n.type,value:u}):(Object.assign(t.renderStates.constantMap,u.constantMap),Object.assign(t.renderStates.variableMap,u.variableMap))},e._parseVariableDeclaration=function(e,t){var n=t.scanToken();t.scanText(";"),this._symbolTableStack.insert({type:n.type,ident:n.lexeme})},e._newScope=function(){var e=new tl;this._symbolTableStack.newScope(e)},e._dropScope=function(){this._symbolTableStack.dropScope()},e._parseRenderStatePropList=function(e,t){for(var n={constantMap:{},variableMap:{}};"}"!==t.getCurChar();)this._parseRenderStatePropItem(n,e,t),t.skipCommentsAndSpace();return t._advance(),n},e._parseRenderStatePropItem=function(n,r,i){var a=i.scanToken().lexeme,o=i.scanToken();if("BlendState"===r&&"BlendColor"!==a&&"AlphaToCoverage"!==a){var s=0;"["===o.lexeme?(s=i.scanNumber(),i.scanText("]"),i.scanText("=")):"="!==o.lexeme&&eS.createGSError("Invalid syntax, expect character '=', but got "+o.lexeme,eE.CompilationError,i.source,i.getCurPosition()),a+=s}a=r+a;var c=t.RenderStateDataKey[a];if(void 0==c&&eS.createGSError("Invalid render state element "+a,eE.CompilationError,i.source,i.getCurPosition()),i.skipCommentsAndSpace(),/[0-9.]/.test(i.getCurChar()))p=i.scanNumber();else{var u=i.scanToken();if(u.type===eh.TRUE)p=!0;else if(u.type===eh.FALSE)p=!1;else if(u.type===eh.GS_Color){i.scanText("(");for(var l=[];;){if(l.push(i.scanNumber()),i.skipCommentsAndSpace(),")"===i.peek(1)){i._advance();break}i.scanText(",")}p=to(t.Color,[].concat(l))}else if("."===i.getCurChar()){i._advance();var p,h,d=i.scanToken();void 0==(p=null==(h=e._engineType[u.lexeme])?void 0:h[d.lexeme])&&eS.createGSError("Invalid engine constant: "+u.lexeme+"."+d.lexeme,eE.CompilationError,i.source,d.location)}else p=u.lexeme}i.scanText(";"),"string"==typeof p?n.variableMap[c]=p:n.constantMap[c]=p},e._parseRenderQueueAssignment=function(n,r){r.scanText("=");var i=r.scanToken();r.scanText(";");var a=e._engineType.RenderQueueType[i.lexeme],o=t.RenderStateDataKey.RenderQueueType;void 0==a?n.renderStates.variableMap[o]=i.lexeme:n.renderStates.constantMap[o]=a},e._addGlobalStatement=function(e,t,n,r){t.current>n.index+r&&e.globalContents.push({range:{start:n,end:ts({},t.getCurPosition(),{index:t.current-r-1})},content:t.source.substring(n.index,t.current-r-1)})},e._parseSubShader=function(t){this._newScope();var n={passes:[],globalContents:[],renderStates:{constantMap:{},variableMap:{}},tags:{}},r=1;n.name=t.scanPairedText('"','"'),t.scanText("{"),t.skipCommentsAndSpace();for(var i=t.getCurPosition();;){var a=t.scanToken();switch(a.type){case eh.GS_Pass:this._addGlobalStatement(n,t,i,a.lexeme.length);var o=this._parsePass(t);n.passes.push(o),i=t.getCurPosition();break;case eh.GS_RenderQueueType:this._addGlobalStatement(n,t,i,a.lexeme.length),this._parseRenderQueueAssignment(n,t),i=t.getCurPosition();break;case eh.GS_UsePass:this._addGlobalStatement(n,t,i,a.lexeme.length);var s=t.scanPairedText('"','"');n.passes.push({name:s,isUsePass:!0,renderStates:{constantMap:{},variableMap:{}},tags:{}}),i=t.getCurPosition();break;case eh.GS_Tags:this._addGlobalStatement(n,t,i,a.lexeme.length),this._parseTags(n,t),i=t.getCurPosition();break;case e_.NOT_WORD:if("{"===a.lexeme)r+=1;else if("}"===a.lexeme&&0==(r-=1))return this._addGlobalStatement(n,t,i,a.lexeme.length),this._dropScope(),n;default:if(e._isRenderStateDeclarator(a)){this._addGlobalStatement(n,t,i,a.lexeme.length),this._parseRenderStateDeclarationOrAssignment(n,a,t),i=t.getCurPosition();break}e._isEngineType(a)&&(this._addGlobalStatement(n,t,i,a.lexeme.length),this._parseVariableDeclaration(a.type,t),i=t.getCurPosition())}}},e._parseTags=function(e,t){for(t.scanText("{");;){var n=t.scanToken();t.scanText("=");var r=t.scanPairedText('"','"');if(t.skipCommentsAndSpace(),e.tags[n.lexeme]=r,"}"===t.peek(1)){t._advance();return}t.scanText(",")}},e._parsePass=function(t){this._newScope();var n={globalContents:[],renderStates:{constantMap:{},variableMap:{}},tags:{}};n.name=t.scanPairedText('"','"'),t.scanText("{");var r=1;t.skipCommentsAndSpace();for(var i=t.getCurPosition();;){var a=t.scanToken();switch(a.type){case eh.GS_RenderQueueType:this._addGlobalStatement(n,t,i,a.lexeme.length),this._parseRenderQueueAssignment(n,t),i=t.getCurPosition();break;case eh.GS_Tags:this._addGlobalStatement(n,t,i,a.lexeme.length),this._parseTags(n,t),i=t.getCurPosition();break;case eh.GS_VertexShader:case eh.GS_FragmentShader:this._addGlobalStatement(n,t,i,a.lexeme.length),t.scanText("=");var o=t.scanToken();n[a.lexeme]&&eS.createGSError("reassign main entry",eE.CompilationError,t.source,t.getCurPosition()),n[a.type===eh.GS_VertexShader?"vertexEntry":"fragmentEntry"]=o.lexeme,t.scanText(";"),i=t.getCurPosition();break;case e_.NOT_WORD:if("{"===a.lexeme)r+=1;else if("}"===a.lexeme&&0==(r-=1))return this._addGlobalStatement(n,t,i,a.lexeme.length),this._dropScope(),n;default:if(e._isRenderStateDeclarator(a)){this._addGlobalStatement(n,t,i,a.lexeme.length),this._parseRenderStateDeclarationOrAssignment(n,a,t),i=t.getCurPosition();break}e._isEngineType(a)&&(this._addGlobalStatement(n,t,i,a.lexeme.length),this._parseVariableDeclaration(a.type,t),i=t.getCurPosition())}}},e}();td._engineType={RenderQueueType:t.RenderQueueType,CompareFunction:t.CompareFunction,StencilOperation:t.StencilOperation,BlendOperation:t.BlendOperation,BlendFactor:t.BlendFactor,CullMode:t.CullMode},td._errors=[],td._symbolTableStack=new eN;var t_=/*#__PURE__*/function(){function e(){}var n=e.prototype;return n._parseShaderPass=function(n,i,a,o,s,c,u){e9.reset(t.ShaderLib,u);for(var l,p=r(o);!(l=p()).done;){var h=l.value;e9.addPredefinedMacro(h.name,h.value)}for(var d=0;d<c.length;d++)e9.addPredefinedMacro(c[d]);var _=performance.now(),f=e9.process(n);t.Logger.info("[pass compilation - preprocessor] cost time "+(performance.now()-_)+"ms");var S=new eC(f).tokenize(),g=e._parser;e._processingPassText=f;var v=g.parse(S);if(v){var m=s===t.ShaderPlatformTarget.GLES100?tr.getVisitor():ti.getVisitor(),y=performance.now(),x=m.visitShaderProgram(v,i,a);return t.Logger.info("[CodeGen] cost time: "+(performance.now()-y)+"ms"),e._processingPassText=void 0,x}},n._parseShaderContent=function(e){return eS.clearAllShaderLabObjectPool(),td.reset(),td.parse(e)},e.createPosition=function(e,t,n){var r=this._shaderPositionPool.get();return r.set(e),r},e.createRange=function(e,t){var n=this._shaderRangePool.get();return n.set(e,t),n},e}();t_._parser=eY.create(),t_._shaderPositionPool=eS.createObjectPool(ep),t_._shaderRangePool=eS.createObjectPool(el);var tf="1.4.0-beta.0";console.log("Galacean ShaderLab version: "+tf+". mode: Release"),e.ShaderLab=t_,e.version=tf,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@galacean/engine")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).Galacean=e.Galacean||{},e.Galacean.ShaderLab={}),e.Galacean)}(this,function(e,t){"use strict";function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function r(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return n(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(e,void 0)}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}function o(e,t,n,r){var i,a=arguments.length,o=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError;var s,c,u,l,p,h,d,_,f,S,g,v,m,y,x,E,T,C,b,A,P,R,I,O,L,k,N,G,M,D,F,B,w,U,V,W,H,j,q,z,Q,X,K,Y,J,$,Z,ee,et,en,er,ei,ea,eo,es,ec,eu,el=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t){this.start=e,this.end=t},t.dispose=function(){this.start.dispose(),this.end.dispose()},e}(),ep=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e){this.index=e},t.dispose=function(){this.index=0},e}(),eh=((s={})[s.ATTRIBUTE=0]="ATTRIBUTE",s[s.CONST=1]="CONST",s[s.BOOL=2]="BOOL",s[s.FLOAT=3]="FLOAT",s[s.DOUBLE=4]="DOUBLE",s[s.INT=5]="INT",s[s.UINT=6]="UINT",s[s.BREAK=7]="BREAK",s[s.CONTINUE=8]="CONTINUE",s[s.DO=9]="DO",s[s.ELSE=10]="ELSE",s[s.FOR=11]="FOR",s[s.IF=12]="IF",s[s.WHILE=13]="WHILE",s[s.DISCARD=14]="DISCARD",s[s.RETURN=15]="RETURN",s[s.BVEC2=16]="BVEC2",s[s.BVEC3=17]="BVEC3",s[s.BVEC4=18]="BVEC4",s[s.IVEC2=19]="IVEC2",s[s.IVEC3=20]="IVEC3",s[s.IVEC4=21]="IVEC4",s[s.UVEC2=22]="UVEC2",s[s.UVEC3=23]="UVEC3",s[s.UVEC4=24]="UVEC4",s[s.VEC2=25]="VEC2",s[s.VEC3=26]="VEC3",s[s.VEC4=27]="VEC4",s[s.VEC4_ARRAY=28]="VEC4_ARRAY",s[s.MAT2=29]="MAT2",s[s.MAT3=30]="MAT3",s[s.MAT4=31]="MAT4",s[s.MAT2X3=32]="MAT2X3",s[s.MAT2X4=33]="MAT2X4",s[s.MAT3X2=34]="MAT3X2",s[s.MAT3X4=35]="MAT3X4",s[s.MAT4X2=36]="MAT4X2",s[s.MAT4X3=37]="MAT4X3",s[s.IN=38]="IN",s[s.OUT=39]="OUT",s[s.INOUT=40]="INOUT",s[s.CENTROID=41]="CENTROID",s[s.SAMPLER2D=42]="SAMPLER2D",s[s.SAMPLER3D=43]="SAMPLER3D",s[s.SAMPLER_CUBE=44]="SAMPLER_CUBE",s[s.SAMPLER2D_SHADOW=45]="SAMPLER2D_SHADOW",s[s.SAMPLER_CUBE_SHADOW=46]="SAMPLER_CUBE_SHADOW",s[s.SAMPLER2D_ARRAY=47]="SAMPLER2D_ARRAY",s[s.SAMPLER2D_ARRAY_SHADOW=48]="SAMPLER2D_ARRAY_SHADOW",s[s.I_SAMPLER2D=49]="I_SAMPLER2D",s[s.I_SAMPLER3D=50]="I_SAMPLER3D",s[s.I_SAMPLER_CUBE=51]="I_SAMPLER_CUBE",s[s.I_SAMPLER2D_ARRAY=52]="I_SAMPLER2D_ARRAY",s[s.U_SAMPLER2D=53]="U_SAMPLER2D",s[s.U_SAMPLER3D=54]="U_SAMPLER3D",s[s.U_SAMPLER_CUBE=55]="U_SAMPLER_CUBE",s[s.U_SAMPLER2D_ARRAY=56]="U_SAMPLER2D_ARRAY",s[s.STRUCT=57]="STRUCT",s[s.LAYOUT=58]="LAYOUT",s[s.LOCATION=59]="LOCATION",s[s.VOID=60]="VOID",s[s.TRUE=61]="TRUE",s[s.FALSE=62]="FALSE",s[s.PRECISION=63]="PRECISION",s[s.PRECISE=64]="PRECISE",s[s.HIGHP=65]="HIGHP",s[s.MEDIUMP=66]="MEDIUMP",s[s.LOWP=67]="LOWP",s[s.INVARIANT=68]="INVARIANT",s[s.SMOOTH=69]="SMOOTH",s[s.FLAT=70]="FLAT",s[s.NOPERSPECTIVE=71]="NOPERSPECTIVE",s[s.GS_RenderQueueType=72]="GS_RenderQueueType",s[s.GS_BlendState=73]="GS_BlendState",s[s.GS_DepthState=74]="GS_DepthState",s[s.GS_StencilState=75]="GS_StencilState",s[s.GS_RasterState=76]="GS_RasterState",s[s.GS_EditorProperties=77]="GS_EditorProperties",s[s.GS_EditorMacros=78]="GS_EditorMacros",s[s.GS_Editor=79]="GS_Editor",s[s.GS_Tags=80]="GS_Tags",s[s.GS_ReplacementTag=81]="GS_ReplacementTag",s[s.GS_LightMode=82]="GS_LightMode",s[s.GS_PipelineStage=83]="GS_PipelineStage",s[s.GS_VertexShader=84]="GS_VertexShader",s[s.GS_FragmentShader=85]="GS_FragmentShader",s[s.GS_SubShader=86]="GS_SubShader",s[s.GS_Pass=87]="GS_Pass",s[s.GS_BlendFactor=88]="GS_BlendFactor",s[s.GS_BlendOperation=89]="GS_BlendOperation",s[s.GS_Bool=90]="GS_Bool",s[s.GS_Number=91]="GS_Number",s[s.GS_Color=92]="GS_Color",s[s.GS_CompareFunction=93]="GS_CompareFunction",s[s.GS_StencilOperation=94]="GS_StencilOperation",s[s.GS_CullMode=95]="GS_CullMode",s[s.GS_UsePass=96]="GS_UsePass",s),ed=new Map([["attribute",eh.ATTRIBUTE],["const",eh.CONST],["bool",eh.BOOL],["float",eh.FLOAT],["double",eh.DOUBLE],["int",eh.INT],["uint",eh.UINT],["break",eh.BREAK],["continue",eh.CONTINUE],["do",eh.DO],["else",eh.ELSE],["for",eh.FOR],["if",eh.IF],["while",eh.WHILE],["discard",eh.DISCARD],["return",eh.RETURN],["bvec2",eh.BVEC2],["bvec3",eh.BVEC3],["bvec4",eh.BVEC4],["ivec2",eh.IVEC2],["ivec3",eh.IVEC3],["ivec4",eh.IVEC4],["uvec2",eh.UVEC2],["uvec3",eh.UVEC3],["uvec4",eh.UVEC4],["vec2",eh.VEC2],["vec3",eh.VEC3],["vec4",eh.VEC4],["mat2",eh.MAT2],["mat3",eh.MAT3],["mat4",eh.MAT4],["in",eh.IN],["out",eh.OUT],["inout",eh.INOUT],["sampler2D",eh.SAMPLER2D],["samplerCube",eh.SAMPLER_CUBE],["sampler3D",eh.SAMPLER3D],["sampler2DShadow",eh.SAMPLER2D_SHADOW],["samplerCubeShadow",eh.SAMPLER_CUBE_SHADOW],["sampler2DArray",eh.SAMPLER2D_ARRAY],["sampler2DArrayShadow",eh.SAMPLER2D_ARRAY_SHADOW],["isampler2D",eh.I_SAMPLER2D],["isampler3D",eh.I_SAMPLER3D],["isamplerCube",eh.I_SAMPLER_CUBE],["isampler2DArray",eh.I_SAMPLER2D_ARRAY],["usampler2D",eh.U_SAMPLER2D],["usampler3D",eh.U_SAMPLER3D],["usamplerCube",eh.U_SAMPLER_CUBE],["usampler2DArray",eh.U_SAMPLER2D_ARRAY],["struct",eh.STRUCT],["void",eh.VOID],["true",eh.TRUE],["false",eh.FALSE],["precision",eh.PRECISION],["precise",eh.PRECISE],["highp",eh.HIGHP],["mediump",eh.MEDIUMP],["lowp",eh.LOWP],["invariant",eh.INVARIANT],["flat",eh.FLAT],["smooth",eh.SMOOTH],["noperspective",eh.NOPERSPECTIVE],["centroid",eh.CENTROID],["layout",eh.LAYOUT],["location",eh.LOCATION]]),e_=((c={})[c.ID=1e3]="ID",c[c.FLOAT_CONSTANT=1001]="FLOAT_CONSTANT",c[c.INT_CONSTANT=1002]="INT_CONSTANT",c[c.STRING_CONST=1003]="STRING_CONST",c[c.LEFT_OP=1004]="LEFT_OP",c[c.RIGHT_OP=1005]="RIGHT_OP",c[c.INC_OP=1006]="INC_OP",c[c.DEC_OP=1007]="DEC_OP",c[c.LE_OP=1008]="LE_OP",c[c.GE_OP=1009]="GE_OP",c[c.EQ_OP=1010]="EQ_OP",c[c.NE_OP=1011]="NE_OP",c[c.AND_OP=1012]="AND_OP",c[c.OR_OP=1013]="OR_OP",c[c.XOR_OP=1014]="XOR_OP",c[c.MUL_ASSIGN=1015]="MUL_ASSIGN",c[c.DIV_ASSIGN=1016]="DIV_ASSIGN",c[c.ADD_ASSIGN=1017]="ADD_ASSIGN",c[c.SUB_ASSIGN=1018]="SUB_ASSIGN",c[c.MOD_ASSIGN=1019]="MOD_ASSIGN",c[c.LEFT_ASSIGN=1020]="LEFT_ASSIGN",c[c.RIGHT_ASSIGN=1021]="RIGHT_ASSIGN",c[c.AND_ASSIGN=1022]="AND_ASSIGN",c[c.XOR_ASSIGN=1023]="XOR_ASSIGN",c[c.OR_ASSIGN=1024]="OR_ASSIGN",c[c.LEFT_PAREN=1025]="LEFT_PAREN",c[c.RIGHT_PAREN=1026]="RIGHT_PAREN",c[c.LEFT_BRACKET=1027]="LEFT_BRACKET",c[c.RIGHT_BRACKET=1028]="RIGHT_BRACKET",c[c.LEFT_BRACE=1029]="LEFT_BRACE",c[c.RIGHT_BRACE=1030]="RIGHT_BRACE",c[c.DOT=1031]="DOT",c[c.COMMA=1032]="COMMA",c[c.COLON=1033]="COLON",c[c.EQUAL=1034]="EQUAL",c[c.SEMICOLON=1035]="SEMICOLON",c[c.BANG=1036]="BANG",c[c.DASH=1037]="DASH",c[c.TILDE=1038]="TILDE",c[c.PLUS=1039]="PLUS",c[c.STAR=1040]="STAR",c[c.SLASH=1041]="SLASH",c[c.PERCENT=1042]="PERCENT",c[c.LEFT_ANGLE=1043]="LEFT_ANGLE",c[c.RIGHT_ANGLE=1044]="RIGHT_ANGLE",c[c.VERTICAL_BAR=1045]="VERTICAL_BAR",c[c.CARET=1046]="CARET",c[c.AMPERSAND=1047]="AMPERSAND",c[c.QUESTION=1048]="QUESTION",c[c.NOT_WORD=1049]="NOT_WORD",c[c.EPSILON=1998]="EPSILON",c[c.EOF=1999]="EOF",c);function ef(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var eS=/*#__PURE__*/function(){function e(){}return e.createObjectPool=function(n){var r=new t.ClearableObjectPool(n);return e._shaderLabObjectPoolSet.push(r),r},e.clearAllShaderLabObjectPool=function(){for(var t=0,n=e._shaderLabObjectPoolSet.length;t<n;t++)e._shaderLabObjectPoolSet[t].clear()},e.createGSError=function(e,n,r,i,a){t.Logger.error(e)},e}();eS._shaderLabObjectPoolSet=[];var eg=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t,n){if(this.type=e,this.lexeme=t,n){if(ef(n,el))this.location=n;else{var r=t_.createPosition(n.index+t.length);this.location=t_.createRange(n,r)}}},t.dispose=function(){},e}();eg.pool=eS.createObjectPool(eg);var ev=new eg;ev.set(e_.EOF,"/EOF");var em=/*#__PURE__*/function(){function e(){}return e.isNum=function(e){return e>=48&&e<=57},e.isLetter=function(e){return 95===e||e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122},e.isAlpha=function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122},e.isPpCharactors=function(e){return 35===e||46===e||95===e||e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122},e.isSpace=function(e){return 9===e||10===e||13===e||32===e},e}();function ey(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ex(e,t,n){return t&&ey(e.prototype,t),n&&ey(e,n),e}var eE=((u={}).PreprocessorError="PreprocessorError",u.CompilationError="CompilationError",u.ScannerError="ScannerError",u),eT=/*#__PURE__*/function(){function e(e,t){void 0===t&&(t=new Map),this._currentIndex=0,this._source=e,this._keywordsMap=t}var t=e.prototype;return t.getCurPosition=function(){return t_.createPosition(this._currentIndex)},t.isEnd=function(){return this._currentIndex>=this._source.length},t.getCurChar=function(){return this._source[this._currentIndex]},t.getCurCharCode=function(){return this._source.charCodeAt(this._currentIndex)},t.advance=function(e){void 0===e&&(e=1),this._currentIndex+=e},t._advance=function(){this._currentIndex++},t.skipSpace=function(t){for(var n=t?e._spaceCharsWithBreak:e._spaceChars,r=this.getCurChar();e._checkIsIn(r,n);)this._advance(),r=this.getCurChar()},t.skipCommentsAndSpace=function(){if(this.skipSpace(!0),"//"===this.peek(2)){var e=this.getCurPosition();this.advance(2);for(var t=this.getCurChar();"\n"!==t&&"\r"!==t&&!this.isEnd();)this._advance(),t=this.getCurChar();return this.skipCommentsAndSpace(),t_.createRange(e,this.getCurPosition())}if("/*"===this.peek(2)){var n=this.getCurPosition();for(this.advance(2);"*/"!==this.peek(2)&&!this.isEnd();)this._advance();return this.advance(2),this.skipCommentsAndSpace(),t_.createRange(n,this.getCurPosition())}},t.peek=function(e){var t=this._currentIndex;return this._source.substring(t,t+e)},t.scanText=function(e){this.skipCommentsAndSpace();var t=this.peek(e.length);t!==e&&this.throwError(this.getCurPosition(),'Expect text "'+e+'", but got "'+t+'"'),this.advance(e.length)},t.throwError=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw eS.createGSError(n.join(" "),eE.ScannerError,this._source,e)},t.scanPairedText=function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1),r||this.scanText(e);for(var i=this._currentIndex,a=n?1:0;this.peek(t.length)!==t||0!==a;){if(this.isEnd())return;if(n){if(this.peek(e.length)===e){a+=1,this.advance(e.length);continue}if(this.peek(t.length)===t){if(0==(a-=1))break;this.advance(t.length);continue}}this.advance(t.length)}return this.advance(t.length),this._source.substring(i,this._currentIndex-t.length)},t.scanToken=function(e,t){void 0===t&&(t=/\w/),this.skipCommentsAndSpace();var n,r=this.getCurPosition();if(!this.isEnd()){for(;t.test(this.getCurChar())&&!this.isEnd();)this._advance();var i=this.getCurPosition();if(r.index===i.index){this._advance();var a=eg.pool.get();return a.set(e_.NOT_WORD,this._source[r.index],r),null==e||e(a,this),a}var o=this._source.substring(r.index,i.index),s=null!=(n=this._keywordsMap.get(o))?n:e_.ID,c=t_.createRange(r,i),u=eg.pool.get();return u.set(s,o,c),null==e||e(u,this),u}},e._checkIsIn=function(e,t){for(var n=0;n<t.length;n++)if(e===t[n])return!0;return!1},ex(e,[{key:"current",get:function(){return this._currentIndex}},{key:"source",get:function(){return this._source}}]),e}();eT._spaceCharsWithBreak=[" "," ","\n","\r"],eT._spaceChars=[" "," "];var eC=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.reset=function(e){this._source=e,this._currentIndex=0},n.tokenize=function(){return function(e,t){var n,r,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(e){switch(e.label){case 0:if(this.isEnd())return[3,2];return[4,this.scanToken()];case 1:return e.sent(),[3,0];case 2:return[2,ev]}})},n.skipSpace=function(){for(;em.isSpace(this.getCurCharCode());)this._advance()},n.scanToken=function(){if(this.skipCommentsAndSpace(),this.isEnd())return ev;if(em.isAlpha(this.getCurCharCode()))return this._scanWord();if(em.isNum(this.getCurCharCode()))return this._scanNum();var e,t=this._getPosition(),n=eg.pool.get();switch(this.getCurChar()){case"<":if(this._advance(),"<"===(e=this.getCurChar())){if(this._advance(),"="===this.getCurChar()){this._advance(),n.set(e_.LEFT_ASSIGN,"<<=",t);break}n.set(e_.LEFT_OP,"<<",t);break}if("="===e){this._advance(),n.set(e_.LE_OP,"<=",t);break}n.set(e_.LEFT_ANGLE,"<",t);break;case">":if(this._advance(),">"===(e=this.getCurChar())){if(this._advance(),"="===this.getCurChar()){this._advance(),n.set(e_.RIGHT_ASSIGN,">>=",t);break}n.set(e_.RIGHT_OP,">>",t);break}if("="===e){this._advance(),n.set(e_.GE_OP,">=",t);break}n.set(e_.RIGHT_ANGLE,">",t);break;case"+":if(this._advance(),"+"===(e=this.getCurChar())){this._advance(),n.set(e_.INC_OP,"++",t);break}if("="===e){this._advance(),n.set(e_.ADD_ASSIGN,"+=",t);break}n.set(e_.PLUS,"+",t);break;case"-":if(this._advance(),"-"===(e=this.getCurChar())){this._advance(),n.set(e_.DEC_OP,"--",t);break}if("="===e){this._advance(),n.set(e_.SUB_ASSIGN,"-=",t);break}n.set(e_.DASH,"-",t);break;case"=":if(this._advance(),"="===this.getCurChar()){this._advance(),n.set(e_.EQ_OP,"==",t);break}n.set(e_.EQUAL,"=",t);break;case"!":if(this._advance(),"="===this.getCurChar()){this._advance(),n.set(e_.NE_OP,"!=",t);break}n.set(e_.BANG,"!",t);break;case"&":if(this._advance(),"&"===(e=this.getCurChar())){this._advance(),n.set(e_.AND_OP,"&&",t);break}if("="===e){this._advance(),n.set(e_.ADD_ASSIGN,"&=",t);break}n.set(e_.AMPERSAND,"&",t);break;case"|":if(this._advance(),"|"===(e=this.getCurChar())){this._advance(),n.set(e_.OR_OP,"||",t);break}if("="===e){this._advance(),n.set(e_.OR_ASSIGN,"|=",t);break}n.set(e_.VERTICAL_BAR,"|",t);break;case"^":if(this._advance(),"^"===(e=this.getCurChar())){this._advance(),n.set(e_.XOR_OP,"^^",t);break}if("="===e){this._advance(),n.set(e_.XOR_ASSIGN,"^=",t);break}n.set(e_.CARET,"^",t);break;case"*":if(this._advance(),"="===this.getCurChar()){this._advance(),n.set(e_.MUL_ASSIGN,"*=",t);break}n.set(e_.STAR,"*",t);break;case"/":if(this._advance(),"="===this.getCurChar()){this._advance(),n.set(e_.DIV_ASSIGN,"/=",t);break}n.set(e_.SLASH,"/",t);break;case"%":if(this._advance(),"="===this.getCurChar()){this._advance(),n.set(e_.MOD_ASSIGN,"%=",t);break}n.set(e_.PERCENT,"%",t);break;case"(":this._advance(),n.set(e_.LEFT_PAREN,"(",t);break;case")":this._advance(),n.set(e_.RIGHT_PAREN,")",t);break;case"{":this._advance(),n.set(e_.LEFT_BRACE,"{",t);break;case"}":this._advance(),n.set(e_.RIGHT_BRACE,"}",t);break;case"[":this._advance(),n.set(e_.LEFT_BRACKET,"[",t);break;case"]":this._advance(),n.set(e_.RIGHT_BRACKET,"]",t);break;case".":if(this._advance(),em.isNum(this.getCurCharCode()))return this._scanNumAfterDot();n.set(e_.DOT,".",t);break;case",":this._advance(),n.set(e_.COMMA,",",t);break;case":":this._advance(),n.set(e_.COLON,":",t);break;case";":this._advance(),n.set(e_.SEMICOLON,";",t);break;case"~":this._advance(),n.set(e_.TILDE,"~",t);break;case"?":this._advance(),n.set(e_.QUESTION,"?",t);break;case'"':return this._advance(),this._scanStringConst();default:this.throwError(this.getCurPosition(),"Unexpected character "+this.getCurChar())}return n},n._scanStringConst=function(){for(var e=this._getPosition(),t=[];'"'!==this.getCurChar();)t.push(this.getCurChar()),this._advance();this._advance();var n=t_.createRange(e,this._getPosition()),r=eg.pool.get();return r.set(e_.STRING_CONST,t.join(""),n),r},n._scanNumAfterDot=function(){for(var e=["."];em.isNum(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();var t=eg.pool.get();return t.set(e_.FLOAT_CONSTANT,e.join(""),this._getPosition(1)),t},n._getPosition=function(e){return void 0===e&&(e=0),t_.createPosition(this.current-e)},n._scanWord=function(){var e=[this.getCurChar()],t=this._getPosition();for(this._advance();em.isLetter(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();var n=e.join(""),r=ed.get(n);if(r){var i=eg.pool.get();return i.set(r,n,t),i}var a=eg.pool.get();return a.set(e_.ID,n,t),a},n._scanNum=function(){for(var e=[];em.isNum(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();if("."===this.getCurChar()){for(e.push(this.getCurChar()),this._advance();em.isNum(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();this._scanFloatSuffix(e);var t=eg.pool.get();return t.set(e_.FLOAT_CONSTANT,e.join(""),this._getPosition(e.length)),t}if("e"===this.getCurChar()||"E"===this.getCurChar()){this._scanFloatSuffix(e);var n=eg.pool.get();return n.set(e_.FLOAT_CONSTANT,e.join(""),this._getPosition(e.length)),n}this._scanIntegerSuffix(e);var r=eg.pool.get();return r.set(e_.INT_CONSTANT,e.join(""),this._getPosition(e.length)),r},n._scanFloatSuffix=function(e){if("e"===this.getCurChar()||"E"===this.getCurChar())for(e.push(this.getCurChar()),this._advance(),("+"===this.getCurChar()||"-"===this.getCurChar())&&(e.push(this.getCurChar()),this._advance()),em.isNum(this.getCurCharCode())||this.throwError(this.getCurPosition(),"lexing error, invalid exponent suffix.");em.isNum(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();("f"===this.getCurChar()||"F"===this.getCurChar())&&(e.push(this.getCurChar()),this._advance())},n._scanIntegerSuffix=function(e){("u"===this.getCurChar()||"U"===this.getCurChar())&&(e.push(this.getCurChar()),this._advance())},t}(eT),eb=((l={})[l.Shift=0]="Shift",l[l.Reduce=1]="Reduce",l[l.Accept=2]="Accept",l),eA=function(){this.globalPrecisions=[]},eP=function(e,t,n){this.type=e,this.typeLexeme=t,this.arraySpecifier=n},eR=((p={})[p.VAR=0]="VAR",p[p.FN=1]="FN",p[p.STRUCT=2]="STRUCT",p),eI=function(e,t,n,r,i){this.ident=e,this.symbolType=t,this.astNode=n,this.dataType=r,this.signature=i},eO=/*#__PURE__*/function(e){function t(t,n){var r=new eP(n.protoType.returnType.type,n.protoType.returnType.typeSpecifier.lexeme);return e.call(this,t,eR.FN,n,r)||this}return a(t,e),t}(eI),eL=/*#__PURE__*/function(e){function t(t,n){return e.call(this,t,eR.STRUCT,n)||this}return a(t,e),t}(eI),ek=function(){this._table=new Map},eN=/*#__PURE__*/function(){function e(){this.stack=[]}var t=e.prototype;return t.newScope=function(e){this.stack.push(e)},t.clear=function(){this.stack.length=0},t.dropScope=function(){this.stack.pop()},t.insert=function(e){this._scope.insert(e)},ex(e,[{key:"_scope",get:function(){return this.stack[this.stack.length-1]}}]),e}(),eG=/*#__PURE__*/function(e){function n(){return e.apply(this,arguments)||this}a(n,e);var r=n.prototype;return r.insert=function(e){for(var n,r=null!=(n=this._table.get(e.ident))?n:[],i=0;i<r.length;i++)if(this._compareWith(r[i],e.symbolType,e.signature,e.astNode)){t.Logger.warn("replace symbol:",e.ident),r[i]=e;return}r.push(e),this._table.set(e.ident,r)},r.lookup=function(e,t,n,r){var i=this._table.get(e);if(i)for(var a=i.length,o=0;o<a;o++){var s=i[o];if(this._compareWith(s,t,n,r))return s}},r.getAllFnSymbols=function(e){var t;return(null!=(t=this._table.get(e))?t:[]).filter(function(e){return e.symbolType===eR.FN})},r._compareWith=function(e,t,n,r){if(e.symbolType!==t)return!1;if(e.symbolType===eR.FN){if(!r&&!n)return!0;var i=e.astNode.protoType.paramSig,a=null!=n?n:r.protoType.paramSig,o=i.length;if(o!==a.length)return!1;for(var s=0;s<o;s++){var c=i[s],u=a[s];if(3e3!==c&&3e3!==u&&c!==u)return!1}}return!0},n}(ek),eM=/*#__PURE__*/function(e){function t(t,n,r,i){var a;return(a=e.call(this,t,eR.VAR,i,n)||this).isGlobalVariable=r,a}return a(t,e),t}(eI),eD=/*#__PURE__*/function(){function e(){this.semanticStack=[],this.acceptRule=void 0,this.symbolTableStack=new eN,this.curFunctionInfo={},this._shaderData=new eA,this._translationRuleTable=new Map,this.newScope()}var n=e.prototype;return n.reset=function(){this.semanticStack.length=0,this._shaderData=new eA,this.symbolTableStack.clear(),this.newScope()},n.newScope=function(){var e=new eG;this.symbolTableStack.newScope(e)},n.dropScope=function(){return this.symbolTableStack.dropScope()},n.addTranslationRule=function(e,t){this._translationRuleTable.set(e,t)},n.getTranslationRule=function(e){return this._translationRuleTable.get(e)},n.lookupSymbolBy=function(e,t,n,r){for(var i=this.symbolTableStack.stack,a=i.length,o=a-1;o>=0;o--){var s=i[o].lookup(e,t,n,r);if(s)return s}},n.reportError=function(e,n){t.Logger.error(n)},ex(e,[{key:"shaderData",get:function(){return this._shaderData}}]),e}(),eF=((h={})[h.START=2e3]="START",h[h.gs_shader_program=2001]="gs_shader_program",h[h.global_declaration=2002]="global_declaration",h[h.variable_declaration=2003]="variable_declaration",h[h.variable_declaration_list=2004]="variable_declaration_list",h[h.variable_declaration_statement=2005]="variable_declaration_statement",h[h.array_specifier_list=2006]="array_specifier_list",h[h.array_specifier=2007]="array_specifier",h[h.ext_builtin_type_specifier_nonarray=2008]="ext_builtin_type_specifier_nonarray",h[h.precision_specifier=2009]="precision_specifier",h[h.variable_identifier=2010]="variable_identifier",h[h.variable_identifier_node=2011]="variable_identifier_node",h[h.primary_expression=2012]="primary_expression",h[h.postfix_expression=2013]="postfix_expression",h[h.integer_expression=2014]="integer_expression",h[h.function_call=2015]="function_call",h[h.function_call_generic=2016]="function_call_generic",h[h.function_call_header_no_parameters=2017]="function_call_header_no_parameters",h[h.function_call_header_with_parameters=2018]="function_call_header_with_parameters",h[h.function_call_parameter_list=2019]="function_call_parameter_list",h[h.function_call_header=2020]="function_call_header",h[h.function_identifier=2021]="function_identifier",h[h.constructor_identifier=2022]="constructor_identifier",h[h.unary_expression=2023]="unary_expression",h[h.unary_operator=2024]="unary_operator",h[h.multiplicative_expression=2025]="multiplicative_expression",h[h.additive_expression=2026]="additive_expression",h[h.shift_expression=2027]="shift_expression",h[h.relational_expression=2028]="relational_expression",h[h.equality_expression=2029]="equality_expression",h[h.and_expression=2030]="and_expression",h[h.inclusive_or_expression=2031]="inclusive_or_expression",h[h.exclusive_or_expression=2032]="exclusive_or_expression",h[h.logical_and_expression=2033]="logical_and_expression",h[h.logical_xor_expression=2034]="logical_xor_expression",h[h.logical_or_expression=2035]="logical_or_expression",h[h.conditional_expression=2036]="conditional_expression",h[h.assignment_expression=2037]="assignment_expression",h[h.assignment_operator=2038]="assignment_operator",h[h.expression=2039]="expression",h[h.integer_constant_expression=2040]="integer_constant_expression",h[h.integer_constant_expression_operator=2041]="integer_constant_expression_operator",h[h.declaration=2042]="declaration",h[h.function_prototype=2043]="function_prototype",h[h.function_declarator=2044]="function_declarator",h[h.function_header_with_parameters=2045]="function_header_with_parameters",h[h.function_header=2046]="function_header",h[h.function_parameter_list=2047]="function_parameter_list",h[h.parameter_declarator=2048]="parameter_declarator",h[h.parameter_declaration=2049]="parameter_declaration",h[h.parameter_qualifier=2050]="parameter_qualifier",h[h.parameter_type_specifier=2051]="parameter_type_specifier",h[h.init_declarator_list=2052]="init_declarator_list",h[h.single_declaration=2053]="single_declaration",h[h.fully_specified_type=2054]="fully_specified_type",h[h.type_qualifier=2055]="type_qualifier",h[h.single_type_qualifier=2056]="single_type_qualifier",h[h.storage_qualifier=2057]="storage_qualifier",h[h.precision_qualifier=2058]="precision_qualifier",h[h.interpolation_qualifier=2059]="interpolation_qualifier",h[h.invariant_qualifier=2060]="invariant_qualifier",h[h.type_specifier=2061]="type_specifier",h[h.type_specifier_nonarray=2062]="type_specifier_nonarray",h[h.type_specifier_no_prec=2063]="type_specifier_no_prec",h[h.basic_type=2064]="basic_type",h[h.struct_specifier=2065]="struct_specifier",h[h.struct_declaration_list=2066]="struct_declaration_list",h[h.struct_declaration=2067]="struct_declaration",h[h.layout_qualifier=2068]="layout_qualifier",h[h.struct_declarator_list=2069]="struct_declarator_list",h[h.struct_declarator=2070]="struct_declarator",h[h.identifier_list=2071]="identifier_list",h[h.decl_identifier=2072]="decl_identifier",h[h.initializer=2073]="initializer",h[h.initializer_list=2074]="initializer_list",h[h.declaration_statement=2075]="declaration_statement",h[h.simple_statement=2076]="simple_statement",h[h.compound_statement_no_scope=2077]="compound_statement_no_scope",h[h.statement_with_scope=2078]="statement_with_scope",h[h.compound_statement=2079]="compound_statement",h[h.statement=2080]="statement",h[h.statement_list=2081]="statement_list",h[h.iteration_statement_no_new_scope=2082]="iteration_statement_no_new_scope",h[h.expression_statement=2083]="expression_statement",h[h.selection_statement=2084]="selection_statement",h[h.selection_rest_statement=2085]="selection_rest_statement",h[h.condition=2086]="condition",h[h.conditionopt=2087]="conditionopt",h[h.iteration_statement=2088]="iteration_statement",h[h.for_init_statement=2089]="for_init_statement",h[h.for_rest_statement=2090]="for_rest_statement",h[h.jump_statement=2091]="jump_statement",h[h.external_declaration=2092]="external_declaration",h[h.function_definition=2093]="function_definition",h[h.field_selection=2094]="field_selection",h[h.bool_constant=2095]="bool_constant",h[h.function_identifier_node=2096]="function_identifier_node",h[h.typename_identifier_node=2097]="typename_identifier_node",h[h.scope_brace=2098]="scope_brace",h[h.scope_end_brace=2099]="scope_end_brace",h[h._ignore=2100]="_ignore",h),eB=function e(t,n){this.goal=t,this.derivation=n,this.id=e._id++,e.pool.set(this.id,this)};eB._id=0,eB.pool=new Map;var ew=/*#__PURE__*/function(){function e(e,t){this.startSymbol=e,t.unshift(new eB(eF.START,[e])),this.productions=t}var t=e.prototype;return t.getProductionList=function(e){return this.productions.filter(function(t){return t.goal===e})},t.isNullableNT=function(e){return this.productions.find(function(t){return t.goal===e&&t.derivation[0]===e_.EPSILON})},t.getProductionByID=function(e){return eB.pool.get(e)},e.create=function(t,n){return new e(t,n.map(function(e){return new eB(e[0],e.slice(1))}))},e}(),eU=function(e,t,n){this.type=e,this.typeLexeme=t,this.arraySpecifier=n},eV=function(e,t,n){this.typeInfo=e,this.ident=t,this.mrtIndex=n};function eW(e){return function(t){t.prototype.nt=e,t.pool=eS.createObjectPool(t)}}var eH=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t){this._location=e,this._children=t,this.init()},t.init=function(){},t.dispose=function(){},t.codeGen=function(e){return e.defaultCodeGen(this.children)},t.semanticAnalyze=function(e){},ex(e,[{key:"children",get:function(){return this._children}},{key:"location",get:function(){return this._location}}]),e}();(d=eu||(eu={}))._unwrapToken=function(e){if(ef(e,eg))return e;throw"not token"},d.get=function(e,t,n,r){var i=e.get();i.set(n,r),i.semanticAnalyze(t),t.semanticStack.push(i)},_=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(eH),d.TrivialNode=_,_=o([eW(eF._ignore)],_),f=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.newScope()},t}(eH),d.ScopeBrace=f,f=o([eW(eF.scope_brace)],f),S=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.dropScope()},t}(eH),d.ScopeEndBrace=S,S=o([eW(eF.scope_end_brace)],S),g=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.init=function(){this.isFragReturnStatement=!1},n.semanticAnalyze=function(e){d._unwrapToken(this.children[0]).type===eh.RETURN&&(e.curFunctionInfo.returnStatement=this)},n.codeGen=function(e){return e.visitJumpStatement(this)},t}(eH),d.JumpStatement=g,g=o([eW(eF.jump_statement)],g),v=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){this._type=void 0},ex(t,[{key:"type",get:function(){var e;return null!=(e=this._type)?e:3e3},set:function(e){this._type=e}}]),t}(eH),d.ExpressionAstNode=v,m=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.init=function(){this.typeSpecifier=void 0,this.arraySpecifier=void 0},n.semanticAnalyze=function(e){var t,n=this.children,r=n.length,i=n[0],a=i.typeSpecifier;this.typeSpecifier=a,this.arraySpecifier=a.arraySpecifier;var o=n[1];if(2===r||4===r){var s=new eU(i.type,a.lexeme,this.arraySpecifier),c=n[3];t=new eM(o.lexeme,s,!1,c)}else{var u=n[2];this.arraySpecifier=u;var l=new eU(i.type,a.lexeme,this.arraySpecifier),p=n[4];t=new eM(o.lexeme,l,!1,p)}e.symbolTableStack.insert(t)},n.codeGen=function(e){return e.visitSingleDeclaration(this)},t}(eH),d.SingleDeclaration=m,m=o([eW(eF.single_declaration)],m),y=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"qualifierList",get:function(){if(this.children.length>1)return this.children[0].qualifierList}},{key:"typeSpecifier",get:function(){return 1===this.children.length?this.children[0]:this.children[1]}},{key:"type",get:function(){return this.typeSpecifier.type}}]),t}(eH),d.FullySpecifiedType=y,y=o([eW(eF.fully_specified_type)],y),x=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){this.children.length>1?this.qualifierList=[].concat(this.children[0].qualifierList,[this.children[1].qualifier]):this.qualifierList=[this.children[0].qualifier]},t}(eH),d.TypeQualifier=x,x=o([eW(eF.type_qualifier)],x),E=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];ef(t,eg)?this.qualifier=t.type:this.qualifier=t.qualifier,this.lexeme=t.lexeme},t}(eH),d.SingleTypeQualifier=E,E=o([eW(eF.single_type_qualifier)],E),T=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"type",get:function(){return this.children[0].type}},{key:"lexeme",get:function(){return this.children[0].lexeme}},{key:"arraySize",get:function(){var e,t;return null==(t=this.children)?void 0:null==(e=t[1])?void 0:e.size}},{key:"arraySpecifier",get:function(){return this.children[1]}},{key:"isCustom",get:function(){return"string"==typeof this.type}}]),t}(eH),d.TypeSpecifier=T,T=o([eW(eF.type_specifier)],T),C=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"size",get:function(){return this.children[1].value}}]),t}(eH),d.ArraySpecifier=C,C=o([eW(eF.array_specifier)],C),b=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];switch(t.type){case e_.PLUS:this.compute=function(e,t){return e+t};break;case e_.DASH:this.compute=function(e,t){return e-t};break;case e_.STAR:this.compute=function(e,t){return e*t};break;case e_.SLASH:this.compute=function(e,t){return e/t};break;case e_.PERCENT:this.compute=function(e,t){return e%t};break;default:e.reportError(t.location,"not implemented operator "+t.lexeme)}},ex(t,[{key:"lexeme",get:function(){return this.children[0].lexeme}}]),t}(eH),d.IntegerConstantExpressionOperator=b,b=o([eW(eF.integer_constant_expression_operator)],b),A=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.init=function(){this.value=void 0},n.semanticAnalyze=function(e){if(1===this.children.length){var t=this.children[0];ef(t,eg)&&(this.value=Number(t.lexeme))}},t}(eH),d.IntegerConstantExpression=A,A=o([eW(eF.integer_constant_expression)],A),P=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){var e=this.children[0];ef(e,eg)?this.type=e.lexeme:this.type=e.type,this.lexeme=e.lexeme},t}(eH),d.TypeSpecifierNonArray=P,P=o([eW(eF.type_specifier_nonarray)],P),R=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){var e=this.children[0];this.type=e.type,this.lexeme=e.lexeme},t}(eH),d.ExtBuiltinTypeSpecifierNonArray=R,R=o([eW(eF.ext_builtin_type_specifier_nonarray)],R),I=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t;if(3===this.children.length||5===this.children.length)t=new eM(this.children[2].lexeme,this.typeInfo,!1,this),e.symbolTableStack.insert(t);else if(4===this.children.length||6===this.children.length){var n=this.typeInfo,r=this.children[3];n.arraySpecifier=r,t=new eM(this.children[2].lexeme,n,!1,this),e.symbolTableStack.insert(t)}},ex(t,[{key:"typeInfo",get:function(){if(1===this.children.length){var e=this.children[0];return new eU(e.typeSpecifier.type,e.typeSpecifier.lexeme,e.arraySpecifier)}return this.children[0].typeInfo}}]),t}(eH),d.InitDeclaratorList=I,I=o([eW(eF.init_declarator_list)],I),O=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"idList",get:function(){return 2===this.children.length?[this.children[1]]:[].concat(this.children[0].idList,[this.children[2]])}}]),t}(eH),d.IdentifierList=O,O=o([eW(eF.identifier_list)],O),L=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return e.visitDeclaration(this)},t}(eH),d.Declaration=L,L=o([eW(eF.declaration)],L),k=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return e.visitFunctionProtoType(this)},ex(t,[{key:"declarator",get:function(){return this.children[0]}},{key:"ident",get:function(){return this.declarator.ident}},{key:"returnType",get:function(){return this.declarator.returnType}},{key:"parameterList",get:function(){return this.declarator.parameterInfoList}},{key:"paramSig",get:function(){return this.declarator.paramSig}}]),t}(eH),d.FunctionProtoType=k,k=o([eW(eF.function_prototype)],k),N=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.curFunctionInfo.returnStatement=null,e.curFunctionInfo.header=this},ex(t,[{key:"header",get:function(){return this.children[0]}},{key:"parameterList",get:function(){return this.children[1]}},{key:"ident",get:function(){return this.header.ident}},{key:"returnType",get:function(){return this.header.returnType}},{key:"parameterInfoList",get:function(){var e;return null==(e=this.parameterList)?void 0:e.parameterInfoList}},{key:"paramSig",get:function(){var e;return null==(e=this.parameterList)?void 0:e.paramSig}}]),t}(eH),d.FunctionDeclarator=N,N=o([eW(eF.function_declarator)],N),G=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.semanticAnalyze=function(e){e.newScope()},n.codeGen=function(e){return e.visitFunctionHeader(this)},ex(t,[{key:"ident",get:function(){return this.children[1]}},{key:"returnType",get:function(){return this.children[0]}}]),t}(eH),d.FunctionHeader=G,G=o([eW(eF.function_header)],G),M=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return e.visitFunctionParameterList(this)},ex(t,[{key:"parameterInfoList",get:function(){if(1===this.children.length){var e=this.children[0];return[{ident:e.ident,typeInfo:e.typeInfo,astNode:e}]}var t=this.children[0],n=this.children[2];return[].concat(t.parameterInfoList,[{ident:n.ident,typeInfo:n.typeInfo,astNode:n}])}},{key:"paramSig",get:function(){if(1===this.children.length)return[this.children[0].typeInfo.type];var e=this.children[0],t=this.children[2];return e.paramSig.concat([t.typeInfo.type])}}]),t}(eH),d.FunctionParameterList=M,M=o([eW(eF.function_parameter_list)],M),D=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t,n=new eM((t=1===this.children.length?this.children[0]:this.children[1]).ident.lexeme,t.typeInfo,!1,this);e.symbolTableStack.insert(n)},ex(t,[{key:"typeQualifier",get:function(){if(2===this.children.length)return this.children[0]}},{key:"parameterDeclarator",get:function(){return 1===this.children.length?this.children[0]:this.children[1]}},{key:"typeInfo",get:function(){return this.parameterDeclarator.typeInfo}},{key:"ident",get:function(){return this.parameterDeclarator.ident}}]),t}(eH),d.ParameterDeclaration=D,D=o([eW(eF.parameter_declaration)],D),F=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"ident",get:function(){return this.children[1]}},{key:"typeInfo",get:function(){var e=this.children[0],t=this.children[2];return new eU(e.type,e.lexeme,t)}}]),t}(eH),d.ParameterDeclarator=F,F=o([eW(eF.parameter_declarator)],F),B=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(eH),d.CompoundStatementNoScope=B,B=o([eW(eF.compound_statement_no_scope)],B),w=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return e.visitStatementList(this)},t}(eH),d.StatementList=w,w=o([eW(eF.statement_list)],w),U=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.init=function(){this._returnStatement=void 0},n.semanticAnalyze=function(e){e.dropScope();var t=new eO(this.protoType.ident.lexeme,this);e.symbolTableStack.insert(t);var n=e.curFunctionInfo,r=n.header,i=n.returnStatement;r.returnType.type===eh.VOID?i&&e.reportError(r.returnType.location,"Return in void function."):i?this._returnStatement=i:e.reportError(r.returnType.location,"No return statement found."),n.header=void 0,n.returnStatement=void 0},n.codeGen=function(e){return e.visitFunctionDefinition(this)},ex(t,[{key:"returnStatement",get:function(){return this._returnStatement}},{key:"protoType",get:function(){return this.children[0]}},{key:"statements",get:function(){return this.children[1]}}]),t}(eH),d.FunctionDefinition=U,U=o([eW(eF.function_definition)],U),V=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.semanticAnalyze=function(e){this.type=this.children[0].type},n.codeGen=function(e){return e.visitFunctionCall(this)},t}(v),d.FunctionCall=V,V=o([eW(eF.function_call)],V),W=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.init=function(){e.prototype.init.call(this),this.fnSymbol=void 0},n.semanticAnalyze=function(e){var t=this.children[0];if(t.isBuiltin)this.type=t.ident;else{var n,r,i=t.ident;if(4===this.children.length){var a=this.children[2];ef(a,H)&&(r=a.paramSig)}var o=e.lookupSymbolBy(i,eR.FN,r);if(!o)return;this.type=null==o?void 0:null==(n=o.dataType)?void 0:n.type,this.fnSymbol=o}},t}(v),d.FunctionCallGeneric=W,W=o([eW(eF.function_call_generic)],W),H=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"paramSig",get:function(){if(1===this.children.length){var e=this.children[0];return void 0==e.type?[3e3]:[e.type]}var t=this.children[0],n=this.children[2];return void 0==t.paramSig||void 0==n.type?[3e3]:t.paramSig.concat([n.type])}},{key:"paramNodes",get:function(){if(1===this.children.length)return[this.children[0]];var e=this.children[0],t=this.children[2];return e.paramNodes.concat([t])}}]),t}(eH),d.FunctionCallParameterList=H,H=o([eW(eF.function_call_parameter_list)],H),j=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.shaderData.globalPrecisions.push(this)},t}(eH),d.PrecisionSpecifier=j,j=o([eW(eF.precision_specifier)],j),q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.semanticAnalyze=function(e){},n.codeGen=function(e){return e.visitFunctionIdentifier(this)},ex(t,[{key:"ident",get:function(){return this.children[0].type}},{key:"lexeme",get:function(){return this.children[0].lexeme}},{key:"isBuiltin",get:function(){return"string"!=typeof this.ident}}]),t}(eH),d.FunctionIdentifier=q,q=o([eW(eF.function_identifier)],q),z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(v),d.AssignmentExpression=z,z=o([eW(eF.assignment_expression)],z),Q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(v),d.Expression=Q,Q=o([eW(eF.expression)],Q),X=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,n=this.children[0];if(ef(n,ei))this.type=null!=(t=n.typeInfo)?t:3e3;else switch(n.type){case e_.INT_CONSTANT:this._type=eh.INT;break;case e_.FLOAT_CONSTANT:this.type=eh.FLOAT;break;case eh.TRUE:case eh.FALSE:this.type=eh.BOOL}}else{var r=this.children[1];this.type=r.type}},t}(v),d.PrimaryExpression=X,X=o([eW(eF.primary_expression)],X),K=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.init=function(){if(e.prototype.init.call(this),1===this.children.length){var t=this.children[0];this.type=t.type}},n.codeGen=function(e){return e.visitPostfixExpression(this)},t}(v),d.PostfixExpression=K,K=o([eW(eF.postfix_expression)],K),Y=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){6===this.children.length&&(this.ident=this.children[1],e.symbolTableStack.insert(new eL(this.ident.lexeme,this)))},ex(t,[{key:"propList",get:function(){return(6===this.children.length?this.children[3]:this.children[2]).propList}}]),t}(eH),d.StructSpecifier=Y,Y=o([eW(eF.struct_specifier)],Y),J=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"propList",get:function(){if(1===this.children.length)return this.children[0].propList;var e=this.children[0],t=this.children[1];return[e.propList,t.propList].flat()}}]),t}(eH),d.StructDeclarationList=J,J=o([eW(eF.struct_declaration_list)],J),$=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"typeSpecifier",get:function(){return 3===this.children.length?this.children[0]:this.children[1]}},{key:"declaratorList",get:function(){return 3===this.children.length?this.children[1]:this.children[2]}},{key:"propList",get:function(){var e=[],t=this.children[0];if(ef(t,Z)){var n=this.children[1],r=this.children[2],i=new eV(new eU(n.type,n.lexeme),r.ident,t.index);e.push(i)}else for(var a=0;a<this.declaratorList.declaratorList.length;a++){var o=this.declaratorList.declaratorList[a],s=new eV(new eU(this.typeSpecifier.type,this.typeSpecifier.lexeme,o.arraySpecifier),o.ident);e.push(s)}return e}}]),t}(eH),d.StructDeclaration=$,$=o([eW(eF.struct_declaration)],$),Z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"index",get:function(){return Number(this.children[4].lexeme)}}]),t}(eH),d.LayoutQualifier=Z,Z=o([eW(eF.layout_qualifier)],Z),ee=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"declaratorList",get:function(){return 1===this.children.length?[this.children[0]]:[].concat(this.children[0].declaratorList,[this.children[1]])}}]),t}(eH),d.StructDeclaratorList=ee,ee=o([eW(eF.struct_declarator_list)],ee),et=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),ex(t,[{key:"ident",get:function(){return this.children[0]}},{key:"arraySpecifier",get:function(){return this.children[1]}}]),t}(eH),d.StructDeclarator=et,et=o([eW(eF.struct_declarator)],et),en=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.semanticAnalyze=function(e){var t=this.children,n=t[0],r=t[1];this.type=n;var i=new eM(r.lexeme,new eU(n.type,n.typeSpecifier.lexeme),!0,this);e.symbolTableStack.insert(i)},n.codeGen=function(e){return e.visitGlobalVariableDeclaration(this)+";"},t}(eH),d.VariableDeclaration=en,en=o([eW(eF.variable_declaration)],en),er=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children,n=t.length,r=t[0].type;if(this.type=r,1!==n){var i=t[2],a=en.pool.get();3===n?a.set(i.location,[r,i]):a.set(i.location,[r,i,t[3]]),a.semanticAnalyze(e)}},t}(eH),d.VariableDeclarationList=er,er=o([eW(eF.variable_declaration_list)],er),ei=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var n=t.prototype;return n.semanticAnalyze=function(e){var t=this.children[0];this.symbolInfo=e.lookupSymbolBy(t.lexeme,eR.VAR)},n.codeGen=function(e){return e.visitVariableIdentifier(this)},ex(t,[{key:"lexeme",get:function(){return this.children[0].lexeme}},{key:"typeInfo",get:function(){var e;return ef(this.symbolInfo,eM)?this.symbolInfo.dataType.type:null==(e=this.symbolInfo)?void 0:e.type}}]),t}(eH),d.VariableIdentifier=ei,ei=o([eW(eF.variable_identifier)],ei),ea=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){this.shaderData=e.shaderData,this.shaderData.symbolTable=e.symbolTableStack._scope},t}(eH),d.GLShaderProgram=ea,o([eW(eF.gs_shader_program)],ea);var ej=/*#__PURE__*/function(){function e(){}return e.isTerminal=function(e){return e<eF.START},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=e_[e])?t:eh[e]}return eF[e]},e.createProductionWithOptions=function(e,t,n){for(var i,a=[],o=r(t);!(i=o()).done;){var s=i.value;a.push([[].concat([e],s),function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];if(r[0]){var a=r[0].location.start,o=r[r.length-1].location.end,s=t_.createRange(a,o);eu.get(null!=n?n:eu.TrivialNode.pool,e,s,r)}}])}return a},e.addMapSetItem=function(e,t,n){var r,i=null!=(r=e.get(t))?r:new Set;i.add(n),e.set(t,i)},e.isSubSet=function(e,t){for(var n,i=r(e);!(n=i()).done;){var a=n.value;if(!t.has(a))return!1}return!0},e.isActionEqual=function(e,t){return e.action===t.action&&e.target===t.target},e}(),eq=[].concat(ej.createProductionWithOptions(eF.gs_shader_program,[[eF.global_declaration],[eF.gs_shader_program,eF.global_declaration]],eu.GLShaderProgram.pool),ej.createProductionWithOptions(eF.global_declaration,[[eF.precision_specifier],[eF.variable_declaration_statement],[eF.struct_specifier],[eF.function_definition]]),ej.createProductionWithOptions(eF.variable_declaration,[[eF.fully_specified_type,e_.ID],[eF.fully_specified_type,e_.ID,eF.array_specifier]],eu.VariableDeclaration.pool),ej.createProductionWithOptions(eF.variable_declaration_list,[[eF.variable_declaration],[eF.variable_declaration_list,e_.COMMA,e_.ID],[eF.variable_declaration_list,e_.COMMA,e_.ID,eF.array_specifier]],eu.VariableDeclarationList.pool),ej.createProductionWithOptions(eF.variable_declaration_statement,[[eF.variable_declaration_list,e_.SEMICOLON]]),ej.createProductionWithOptions(eF.ext_builtin_type_specifier_nonarray,[[eh.VOID],[eh.FLOAT],[eh.BOOL],[eh.INT],[eh.UINT],[eh.VEC2],[eh.VEC3],[eh.VEC4],[eh.BVEC2],[eh.BVEC3],[eh.BVEC4],[eh.IVEC2],[eh.IVEC3],[eh.IVEC4],[eh.UVEC2],[eh.UVEC3],[eh.UVEC4],[eh.MAT2],[eh.MAT3],[eh.MAT4],[eh.MAT2X3],[eh.MAT2X4],[eh.MAT3X2],[eh.MAT3X4],[eh.MAT4X2],[eh.MAT4X3],[eh.SAMPLER2D],[eh.SAMPLER3D],[eh.SAMPLER_CUBE],[eh.SAMPLER2D_SHADOW],[eh.SAMPLER_CUBE_SHADOW],[eh.SAMPLER2D_ARRAY],[eh.SAMPLER2D_ARRAY_SHADOW],[eh.I_SAMPLER2D],[eh.I_SAMPLER3D],[eh.I_SAMPLER_CUBE],[eh.I_SAMPLER2D_ARRAY],[eh.U_SAMPLER2D],[eh.U_SAMPLER3D],[eh.U_SAMPLER_CUBE],[eh.U_SAMPLER2D_ARRAY]],eu.ExtBuiltinTypeSpecifierNonArray.pool),ej.createProductionWithOptions(eF.type_specifier_nonarray,[[e_.ID],[eF.ext_builtin_type_specifier_nonarray]],eu.TypeSpecifierNonArray.pool),ej.createProductionWithOptions(eF.fully_specified_type,[[eF.type_specifier],[eF.type_qualifier,eF.type_specifier]],eu.FullySpecifiedType.pool),ej.createProductionWithOptions(eF.type_specifier,[[eF.type_specifier_nonarray],[eF.ext_builtin_type_specifier_nonarray,eF.array_specifier]],eu.TypeSpecifier.pool),ej.createProductionWithOptions(eF.type_qualifier,[[eF.single_type_qualifier],[eF.type_qualifier,eF.single_type_qualifier]],eu.TypeQualifier.pool),ej.createProductionWithOptions(eF.single_type_qualifier,[[eF.storage_qualifier],[eF.precision_qualifier],[eF.interpolation_qualifier],[eF.invariant_qualifier],[eh.PRECISE]],eu.SingleTypeQualifier.pool),ej.createProductionWithOptions(eF.storage_qualifier,[[eh.CONST],[eh.IN],[eh.INOUT],[eh.OUT],[eh.CENTROID]]),ej.createProductionWithOptions(eF.interpolation_qualifier,[[eh.SMOOTH],[eh.FLAT]]),ej.createProductionWithOptions(eF.invariant_qualifier,[[eh.INVARIANT]]),ej.createProductionWithOptions(eF.precision_qualifier,[[eh.HIGHP],[eh.MEDIUMP],[eh.LOWP]]),ej.createProductionWithOptions(eF.struct_specifier,[[eh.STRUCT,e_.ID,e_.LEFT_BRACE,eF.struct_declaration_list,e_.RIGHT_BRACE,e_.SEMICOLON],[eh.STRUCT,e_.LEFT_BRACE,eF.struct_declaration_list,e_.RIGHT_BRACE,e_.SEMICOLON]],eu.StructSpecifier.pool),ej.createProductionWithOptions(eF.struct_declaration_list,[[eF.struct_declaration],[eF.struct_declaration_list,eF.struct_declaration]],eu.StructDeclarationList.pool),ej.createProductionWithOptions(eF.struct_declaration,[[eF.type_specifier,eF.struct_declarator_list,e_.SEMICOLON],[eF.type_qualifier,eF.type_specifier,eF.struct_declarator_list,e_.SEMICOLON],[eF.layout_qualifier,eF.type_specifier,eF.struct_declarator,e_.SEMICOLON]],eu.StructDeclaration.pool),ej.createProductionWithOptions(eF.layout_qualifier,[[eh.LAYOUT,e_.LEFT_PAREN,eh.LOCATION,e_.EQUAL,e_.INT_CONSTANT,e_.RIGHT_PAREN]],eu.LayoutQualifier.pool),ej.createProductionWithOptions(eF.struct_declarator_list,[[eF.struct_declarator],[eF.struct_declarator_list,e_.COMMA,eF.struct_declarator]],eu.StructDeclaratorList.pool),ej.createProductionWithOptions(eF.struct_declarator,[[e_.ID],[e_.ID,eF.array_specifier]],eu.StructDeclarator.pool),ej.createProductionWithOptions(eF.array_specifier,[[e_.LEFT_BRACKET,e_.RIGHT_BRACKET],[e_.LEFT_BRACKET,eF.integer_constant_expression,e_.RIGHT_BRACKET]],eu.ArraySpecifier.pool),ej.createProductionWithOptions(eF.integer_constant_expression_operator,[[e_.PLUS],[e_.DASH],[e_.STAR],[e_.SLASH],[e_.PERCENT]],eu.IntegerConstantExpressionOperator.pool),ej.createProductionWithOptions(eF.integer_constant_expression,[[eF.variable_identifier],[e_.INT_CONSTANT],[eF.integer_constant_expression,eF.integer_constant_expression_operator,e_.INT_CONSTANT],[eF.integer_constant_expression,eF.integer_constant_expression_operator,eF.variable_identifier]],eu.IntegerConstantExpression.pool),ej.createProductionWithOptions(eF.conditional_expression,[[eF.logical_or_expression],[eF.logical_or_expression,e_.QUESTION,eF.expression,e_.COLON,eF.assignment_expression]]),ej.createProductionWithOptions(eF.logical_or_expression,[[eF.logical_xor_expression],[eF.logical_or_expression,e_.OR_OP,eF.logical_xor_expression]]),ej.createProductionWithOptions(eF.logical_xor_expression,[[eF.logical_and_expression],[eF.logical_xor_expression,e_.XOR_OP,eF.logical_and_expression]]),ej.createProductionWithOptions(eF.logical_and_expression,[[eF.inclusive_or_expression],[eF.logical_and_expression,e_.AND_OP,eF.inclusive_or_expression]]),ej.createProductionWithOptions(eF.inclusive_or_expression,[[eF.exclusive_or_expression],[eF.inclusive_or_expression,e_.VERTICAL_BAR,eF.exclusive_or_expression]]),ej.createProductionWithOptions(eF.exclusive_or_expression,[[eF.and_expression],[eF.exclusive_or_expression,e_.CARET,eF.and_expression]]),ej.createProductionWithOptions(eF.and_expression,[[eF.equality_expression],[eF.and_expression,e_.AMPERSAND,eF.equality_expression]]),ej.createProductionWithOptions(eF.equality_expression,[[eF.relational_expression],[eF.equality_expression,e_.EQ_OP,eF.relational_expression],[eF.equality_expression,e_.NE_OP,eF.relational_expression]]),ej.createProductionWithOptions(eF.relational_expression,[[eF.shift_expression],[eF.relational_expression,e_.LEFT_ANGLE,eF.shift_expression],[eF.relational_expression,e_.RIGHT_ANGLE,eF.shift_expression],[eF.relational_expression,e_.LE_OP,eF.shift_expression],[eF.relational_expression,e_.GE_OP,eF.shift_expression]]),ej.createProductionWithOptions(eF.shift_expression,[[eF.additive_expression],[eF.shift_expression,e_.LEFT_OP,eF.additive_expression],[eF.shift_expression,e_.RIGHT_OP,eF.additive_expression]]),ej.createProductionWithOptions(eF.additive_expression,[[eF.multiplicative_expression],[eF.additive_expression,e_.PLUS,eF.multiplicative_expression],[eF.additive_expression,e_.DASH,eF.multiplicative_expression]]),ej.createProductionWithOptions(eF.multiplicative_expression,[[eF.unary_expression],[eF.multiplicative_expression,e_.STAR,eF.unary_expression],[eF.multiplicative_expression,e_.SLASH,eF.unary_expression],[eF.multiplicative_expression,e_.PERCENT,eF.unary_expression]]),ej.createProductionWithOptions(eF.unary_expression,[[eF.postfix_expression],[e_.INC_OP,eF.unary_expression],[e_.DEC_OP,eF.unary_expression],[eF.unary_operator,eF.unary_expression]]),ej.createProductionWithOptions(eF.unary_operator,[[e_.PLUS],[e_.DASH],[e_.BANG],[e_.TILDE]]),ej.createProductionWithOptions(eF.postfix_expression,[[eF.primary_expression],[eF.postfix_expression,e_.LEFT_BRACKET,eF.expression,e_.RIGHT_BRACKET],[eF.function_call],[eF.postfix_expression,e_.DOT,e_.ID],[eF.postfix_expression,e_.DOT,eF.function_call],[eF.postfix_expression,e_.INC_OP],[eF.postfix_expression,e_.DEC_OP]],eu.PostfixExpression.pool),ej.createProductionWithOptions(eF.primary_expression,[[eF.variable_identifier],[e_.INT_CONSTANT],[e_.FLOAT_CONSTANT],[eh.TRUE],[eh.FALSE],[e_.LEFT_PAREN,eF.expression,e_.RIGHT_PAREN]],eu.PrimaryExpression.pool),ej.createProductionWithOptions(eF.expression,[[eF.assignment_expression],[eF.expression,e_.COMMA,eF.assignment_expression]],eu.Expression.pool),ej.createProductionWithOptions(eF.assignment_expression,[[eF.conditional_expression],[eF.unary_expression,eF.assignment_operator,eF.assignment_expression]],eu.AssignmentExpression.pool),ej.createProductionWithOptions(eF.assignment_operator,[[e_.EQUAL],[e_.MUL_ASSIGN],[e_.DIV_ASSIGN],[e_.MOD_ASSIGN],[e_.ADD_ASSIGN],[e_.SUB_ASSIGN],[e_.LEFT_ASSIGN],[e_.RIGHT_ASSIGN],[e_.AND_ASSIGN],[e_.XOR_ASSIGN],[e_.OR_ASSIGN]]),ej.createProductionWithOptions(eF.function_call,[[eF.function_call_generic]],eu.FunctionCall.pool),ej.createProductionWithOptions(eF.function_call_generic,[[eF.function_identifier,e_.LEFT_PAREN,eF.function_call_parameter_list,e_.RIGHT_PAREN],[eF.function_identifier,e_.LEFT_PAREN,e_.RIGHT_PAREN],[eF.function_identifier,eh.VOID,e_.RIGHT_PAREN]],eu.FunctionCallGeneric.pool),ej.createProductionWithOptions(eF.function_call_parameter_list,[[eF.assignment_expression],[eF.function_call_parameter_list,e_.COMMA,eF.assignment_expression]],eu.FunctionCallParameterList.pool),ej.createProductionWithOptions(eF.function_identifier,[[eF.type_specifier]],eu.FunctionIdentifier.pool),ej.createProductionWithOptions(eF.function_definition,[[eF.function_prototype,eF.compound_statement_no_scope]],eu.FunctionDefinition.pool),ej.createProductionWithOptions(eF.function_prototype,[[eF.function_declarator,e_.RIGHT_PAREN]],eu.FunctionProtoType.pool),ej.createProductionWithOptions(eF.function_declarator,[[eF.function_header],[eF.function_header,eF.function_parameter_list]],eu.FunctionDeclarator.pool),ej.createProductionWithOptions(eF.function_header,[[eF.fully_specified_type,e_.ID,e_.LEFT_PAREN]],eu.FunctionHeader.pool),ej.createProductionWithOptions(eF.function_parameter_list,[[eF.parameter_declaration],[eF.function_parameter_list,e_.COMMA,eF.parameter_declaration]],eu.FunctionParameterList.pool),ej.createProductionWithOptions(eF.parameter_declaration,[[eF.type_qualifier,eF.parameter_declarator],[eF.parameter_declarator]],eu.ParameterDeclaration.pool),ej.createProductionWithOptions(eF.parameter_declarator,[[eF.type_specifier,e_.ID],[eF.type_specifier,e_.ID,eF.array_specifier]],eu.ParameterDeclarator.pool),ej.createProductionWithOptions(eF.statement_list,[[eF.statement],[eF.statement_list,eF.statement]],eu.StatementList.pool),ej.createProductionWithOptions(eF.statement,[[eF.compound_statement],[eF.simple_statement]]),ej.createProductionWithOptions(eF.compound_statement_no_scope,[[e_.LEFT_BRACE,e_.RIGHT_BRACE],[e_.LEFT_BRACE,eF.statement_list,e_.RIGHT_BRACE]],eu.CompoundStatementNoScope.pool),ej.createProductionWithOptions(eF.compound_statement,[[e_.LEFT_BRACE,e_.RIGHT_BRACE],[eF.scope_brace,eF.statement_list,eF.scope_end_brace]]),ej.createProductionWithOptions(eF.simple_statement,[[eF.declaration],[eF.expression_statement],[eF.selection_statement],[eF.iteration_statement],[eF.jump_statement]]),ej.createProductionWithOptions(eF.declaration,[[eF.function_prototype,e_.SEMICOLON],[eF.init_declarator_list,e_.SEMICOLON],[eh.PRECISION,eF.precision_qualifier,eF.ext_builtin_type_specifier_nonarray,e_.SEMICOLON],[eF.type_qualifier,e_.ID,e_.SEMICOLON],[eF.type_qualifier,e_.ID,eF.identifier_list,e_.SEMICOLON]],eu.Declaration.pool),ej.createProductionWithOptions(eF.identifier_list,[[e_.COMMA,e_.ID],[eF.identifier_list,e_.COMMA,e_.ID]],eu.IdentifierList.pool),ej.createProductionWithOptions(eF.init_declarator_list,[[eF.single_declaration],[eF.init_declarator_list,e_.COMMA,e_.ID],[eF.init_declarator_list,e_.COMMA,e_.ID,eF.array_specifier],[eF.init_declarator_list,e_.COMMA,e_.ID,eF.array_specifier,e_.EQUAL,eF.initializer],[eF.init_declarator_list,e_.COMMA,e_.ID,e_.EQUAL,eF.initializer]],eu.InitDeclaratorList.pool),ej.createProductionWithOptions(eF.single_declaration,[[eF.fully_specified_type,e_.ID],[eF.fully_specified_type,e_.ID,eF.array_specifier],[eF.fully_specified_type,e_.ID,eF.array_specifier,e_.EQUAL,eF.initializer],[eF.fully_specified_type,e_.ID,e_.EQUAL,eF.initializer]],eu.SingleDeclaration.pool),ej.createProductionWithOptions(eF.initializer,[[eF.assignment_expression],[e_.LEFT_BRACE,eF.initializer_list,e_.RIGHT_BRACE]]),ej.createProductionWithOptions(eF.initializer_list,[[eF.initializer],[eF.initializer_list,e_.COMMA,eF.initializer]]),ej.createProductionWithOptions(eF.expression_statement,[[e_.SEMICOLON],[eF.expression,e_.SEMICOLON]]),ej.createProductionWithOptions(eF.selection_statement,[[eh.IF,e_.LEFT_PAREN,eF.expression,e_.RIGHT_PAREN,eF.statement],[eh.IF,e_.LEFT_PAREN,eF.expression,e_.RIGHT_PAREN,eF.statement,eh.ELSE,eF.statement]]),ej.createProductionWithOptions(eF.iteration_statement,[[eh.WHILE,e_.LEFT_PAREN,eF.condition,e_.RIGHT_PAREN,eF.statement],[eh.FOR,e_.LEFT_PAREN,eF.for_init_statement,eF.for_rest_statement,e_.RIGHT_PAREN,eF.statement]]),ej.createProductionWithOptions(eF.precision_specifier,[[eh.PRECISION,eF.precision_qualifier,eF.ext_builtin_type_specifier_nonarray,e_.SEMICOLON]],eu.PrecisionSpecifier.pool),ej.createProductionWithOptions(eF.for_init_statement,[[eF.expression_statement],[eF.declaration]]),ej.createProductionWithOptions(eF.condition,[[eF.expression],[eF.fully_specified_type,e_.ID,e_.EQUAL,eF.initializer]]),ej.createProductionWithOptions(eF.for_rest_statement,[[eF.conditionopt,e_.SEMICOLON],[eF.conditionopt,e_.SEMICOLON,eF.expression]]),ej.createProductionWithOptions(eF.conditionopt,[[e_.EPSILON],[eF.condition]]),ej.createProductionWithOptions(eF.jump_statement,[[eh.CONTINUE,e_.SEMICOLON],[eh.BREAK,e_.SEMICOLON],[eh.RETURN,e_.SEMICOLON],[eh.RETURN,eF.expression,e_.SEMICOLON],[eh.DISCARD,e_.SEMICOLON]],eu.JumpStatement.pool),ej.createProductionWithOptions(eF.scope_brace,[[e_.LEFT_BRACE]],eu.ScopeBrace.pool),ej.createProductionWithOptions(eF.scope_end_brace,[[e_.RIGHT_BRACE]],eu.ScopeEndBrace.pool),ej.createProductionWithOptions(eF.variable_identifier,[[e_.ID]],eu.VariableIdentifier.pool)),ez=function(e){for(var t=0;t<eq.length;t++){var n=eq[t][1];n&&e.addTranslationRule(t,n)}},eQ=/*#__PURE__*/function(){function e(t,n,i){this._needReInfer=!0,this.production=t,this.position=n,this.lookaheadSet=new Set;for(var a,o=r(i);!(a=o()).done;){var s=a.value;this.lookaheadSet.add(s)}this.id=e._id++}var t=e.prototype;return t.addLookahead=function(e){for(var t,n=r(e);!(t=n()).done;){var i=t.value;this.lookaheadSet.has(i)||(this.lookaheadSet.add(i),this.needReInfer=!0)}},t.symbolByOffset=function(e){return this.production.derivation[this.position+e]},t.canReduce=function(){if(this.position>this.production.derivation.length-1)return!0;for(var e=this.position;e<this.production.derivation.length;e++)if(this.production.derivation[e]!==e_.EPSILON)return!1;return!0},t.advance=function(){return new e(this.production,this.position+1,this.lookaheadSet)},ex(e,[{key:"needReInfer",get:function(){return this._needReInfer},set:function(e){this._needReInfer=e}},{key:"curSymbol",get:function(){return this.production.derivation[this.position]}},{key:"nextSymbol",get:function(){return this.production.derivation[this.position+1]}}]),e}();eQ._id=0;var eX=/*#__PURE__*/function(){function e(t){this.closured=!1,this._stateItemPool=new Map,this.id=e._id++,this._items=new Set([].concat(t)),this.cores=new Set([].concat(t));for(var n,i=r(t);!(n=i()).done;){var a=n.value,o=this.getStateItemMapKey(a.production,a.position);this._stateItemPool.set(o,a)}e.pool.set(this.id,this)}var t=e.prototype;return t.getStateItemMapKey=function(e,t){return e.id+","+t},t.createStateItem=function(e,t,n){void 0===n&&(n=new Set);var i=this.getStateItemMapKey(e,t),a=this._stateItemPool.get(i);if(a){for(var o,s=r(n);!(o=s()).done;){var c=o.value;a.lookaheadSet.has(c)||(a.lookaheadSet.add(c),a.needReInfer=!0)}return a}var u=new eQ(e,t,n);return this._stateItemPool.set(i,u),u},e.create=function(t){var n=this.getMapKey(t),i=this.closureMap.get(n);if(i){for(var a,o=r(t);!(a=o()).done;){var s=a.value;i.createStateItem(s.production,s.position,s.lookaheadSet)}return i}var c=new e(t);return this.closureMap.set(n,c),c},e.getMapKey=function(e){return e.map(function(e){return e.production.id+","+e.position}).join(";")},ex(e,[{key:"items",get:function(){return this._items}},{key:"needReInfer",get:function(){for(var e,t=r(this.cores);!(e=t()).done;)if(e.value.needReInfer)return!0;return!1}}]),e}();eX.closureMap=new Map,eX.pool=new Map,eX._id=0;var eK=/*#__PURE__*/function(){function e(e){this.firstSetMap=new Map,this.followSetMap=new Map,this.actionTable=new Map,this.gotoTable=new Map,this._firstSetNTStack=[],this.grammar=e}var t=e.prototype;return t.generate=function(){this.computeFirstSet(),this.buildStateTable()},t.buildStateTable=function(){var e=[new eQ(this.grammar.productions[0],0,[e_.EOF])],t=eX.create(e);this._extendState(t)},t._extendState=function(e){if(e.needReInfer){this._closure(e);for(var t,n=this._inferNextState(e),i=r(n);!(t=i()).done;){var a=t.value;this._extendState(a)}}},t._closure=function(e){for(var t,n=r(e.cores);!(t=n()).done;){var i=t.value;i.canReduce()||this._extendStateItem(e,i)}return e.closured=!0,e},t._extendStateItem=function(e,t){if(!ej.isTerminal(t.curSymbol)){var n=this.grammar.getProductionList(t.curSymbol);if(t.nextSymbol){for(var i=new Set,a=!1,o=1,s=t.symbolByOffset(1);s;s=t.symbolByOffset(++o)){if(ej.isTerminal(s)){i.add(s),a=!0;break}c=this.firstSetMap.get(s);for(var c,u,l=r(c);!(u=l()).done;){var p=u.value;i.add(p)}if(!c.has(e_.EPSILON))break}if(!a&&(null==c?void 0:c.has(e_.EPSILON)))for(var h,d=r(t.lookaheadSet);!(h=d()).done;){var _=h.value;i.add(_)}for(var f,S=r(n);!(f=S()).done;){var g=f.value,v=e.createStateItem(g,0);e.items.has(v)&&ej.isSubSet(i,v.lookaheadSet)||(e.items.add(v),v.addLookahead(i),this._extendStateItem(e,v))}}else for(var m,y=r(n);!(m=y()).done;){var x=m.value,E=e.createStateItem(x,0);e.items.has(E)&&ej.isSubSet(t.lookaheadSet,E.lookaheadSet)||(e.items.add(E),E.addLookahead(t.lookaheadSet),this._extendStateItem(e,E))}}},t._inferNextState=function(e){var t=new Map,n=null!=(a=this.actionTable.get(e.id))?a:new Map,i=null!=(o=this.gotoTable.get(e.id))?o:new Map;this.actionTable.set(e.id,n),this.gotoTable.set(e.id,i);for(var a,o,s,c=r(e.items);!(s=c()).done;){var u=s.value;if(u.canReduce()){var l=void 0;l=u.production.goal!==eF.START?{action:eb.Reduce,target:u.production.id}:{action:eb.Accept};for(var p,h=r(u.lookaheadSet);!(p=h()).done;){var d=p.value;this._addAction(n,d,l)}}else{var _=u.advance();ej.addMapSetItem(t,u.curSymbol,_)}u.needReInfer=!1}for(var f,S=new Set,g=r(t.entries());!(f=g()).done;){var v=f.value,m=v[0],y=v[1],x=eX.create(Array.from(y));ej.isTerminal(m)?this._addAction(n,m,{action:eb.Shift,target:x.id}):i.set(m,x.id),S.add(x)}return S},t._addAction=function(e,t,n){var r=e.get(t);(!r||ej.isActionEqual(r,n)||t!==eh.ELSE||r.action!==eb.Shift||n.action!==eb.Reduce)&&e.set(t,n)},t.computeFirstSet=function(){for(var e,t=r(this.grammar.productions.slice(1));!(e=t()).done;){var n=e.value;this._computeFirstSetForNT(n.goal)}},t._computeFirstSetForNT=function(e){var t=this._firstSetNTStack.findIndex(function(t){return t===e});if(-1!==t){for(var n=this.firstSetMap.get(e),i=this._firstSetNTStack.length,a=i-1;a>t;a--){var o=this._firstSetNTStack[a];this.firstSetMap.set(o,n)}return n}this._firstSetNTStack.push(e);var s=this.grammar.getProductionList(e),c=new Set;this.firstSetMap.set(e,c),this.grammar.isNullableNT(e)&&c.add(e_.EPSILON);for(var u,l=r(s);!(u=l()).done;){for(var p=u.value,h=0;h<p.derivation.length;h++){var d=p.derivation[h];if(ej.isTerminal(d)){c.add(d);break}for(var _,f=this._computeFirstSetForNT(d),S=r(f);!(_=S()).done;){var g=_.value;g!==e_.EPSILON&&c.add(g)}if(!this.grammar.isNullableNT(d))break}h===p.derivation.length&&c.add(e_.EPSILON)}return this._firstSetNTStack.pop(),c},e}(),eY=/*#__PURE__*/function(){function e(e,t,n){this._traceBackStack=[],this.actionTable=e,this.gotoTable=t,this.grammar=n,this.sematicAnalyzer=new eD}return e.prototype.parse=function(e){this.sematicAnalyzer.reset();var n=performance.now(),r=this._traceBackStack,i=this.sematicAnalyzer;r.push(0);for(var a=e.next(),o=0;;){o+=1;var s=a.value,c=this.stateActionTable.get(s.type);if((null==c?void 0:c.action)===eb.Shift)r.push(s,c.target),a=e.next();else{if((null==c?void 0:c.action)===eb.Accept)return t.Logger.info("[pass compilation - parser] Accept! State automata run "+o+" times! cost time "+(performance.now()-n)+"ms"),null==i.acceptRule||i.acceptRule.call(i,i),i.semanticStack.pop();if((null==c?void 0:c.action)!==eb.Reduce)return eS.createGSError("Unexpected token "+s.lexeme,eE.CompilationError,t_._processingPassText,s.location),null;for(var u=c.target,l=this.grammar.getProductionByID(u),p=i.getTranslationRule(l.id),h=[],d=l.derivation.length-1;d>=0;d--)if(l.derivation[d]!==e_.EPSILON){r.pop();var _=r.pop();if(ef(_,eg))h.unshift(_);else{var f=i.semanticStack.pop();h.unshift(f)}}null==p||p.apply(void 0,[].concat([i],h));var S=this.stateGotoTable;r.push(l.goal);var g=null==S?void 0:S.get(l.goal);r.push(g);continue}}},e.create=function(){if(!this._singleton){var t=ew.create(eF.gs_shader_program,eq.map(function(e){return e[0]})),n=new eK(t);n.generate(),this._singleton=new e(n.actionTable,n.gotoTable,t),ez(this._singleton.sematicAnalyzer)}return this._singleton},ex(e,[{key:"curState",get:function(){return this._traceBackStack[this._traceBackStack.length-1]}},{key:"stateActionTable",get:function(){return this.actionTable.get(this.curState)}},{key:"stateGotoTable",get:function(){return this.gotoTable.get(this.curState)}}]),e}();function eJ(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var e$=/*#__PURE__*/function(){function e(e,t,n,r){this.macro=e,this.body=t,this.location=n,this.args=r,r&&(this._argsLexemes=this.args.map(function(e){return e.lexeme}),this._replaceRegex=RegExp("\\b("+this._argsLexemes.join("|")+")\\b","g"))}return e.prototype.expandFunctionBody=function(e){var t,n=this;if(e.length!==(null==(t=this.args)?void 0:t.length))throw eS.createGSError("mismatched function macro",GSErrorName.PreprocessorError,"",this.location);return this.body.lexeme.replace(this._replaceRegex,function(t){return e[n._argsLexemes.indexOf(t)]})},ex(e,[{key:"isFunction",get:function(){var e;return!!(null==(e=this.args)?void 0:e.length)}}]),e}(),eZ=((eo={})[eo.id=0]="id",eo[eo.line_remain=1]="line_remain",eo[eo.chunk=2]="chunk",eo[eo.int_constant=3]="int_constant",eo[eo.string_const=4]="string_const",eo[eo.right_op=5]="right_op",eo[eo.left_op=6]="left_op",eo[eo.left_paren=7]="left_paren",eo[eo.right_paren=8]="right_paren",eo[eo.ge=9]="ge",eo[eo.le=10]="le",eo[eo.eq=11]="eq",eo[eo.neq=12]="neq",eo[eo.and=13]="and",eo[eo.or=14]="or",eo[eo.left_angle=15]="left_angle",eo[eo.right_angle=16]="right_angle",eo[eo.star=17]="star",eo[eo.plus=18]="plus",eo[eo.dash=19]="dash",eo[eo.bang=20]="bang",eo[eo.slash=21]="slash",eo[eo.percent=22]="percent",eo[eo.EOF=100]="EOF",eo),e0=((es={})[es.define=101]="define",es[es.undef=102]="undef",es[es.if=103]="if",es[es.ifdef=104]="ifdef",es[es.ifndef=105]="ifndef",es[es.else=106]="else",es[es.elif=107]="elif",es[es.endif=108]="endif",es[es.include=109]="include",es[es.defined=110]="defined",es),e1=new Map([["#define",101],["#undef",102],["#if",103],["#ifdef",104],["#ifndef",105],["#else",106],["#elif",107],["#endif",108],["#include",109],["defined",110]]),e2=/*#__PURE__*/function(){function e(){}return e.expand=function(e,t){for(var n,i=[],a=0,o=0,s=r(e);!(n=s()).done;){var c=n.value,u=t.slice(a,c.rangeInBlock.start.index);i.push(u,c.replace);var l=o+u.length+c.replace.length;a=c.rangeInBlock.end.index,o=l}return i.push(t.slice(a)),i.join("")},e.assembleSegments=function(e,t){for(var n,i=[],a=0,o=r(e);!(n=o()).done;){var s=n.value,c=t.slice(a,s.range.start.index);i.push(c,s.replace),a=s.range.end.index}return i.push(t.slice(a)),i.join("")},e}(),e3=/*#__PURE__*/function(e){function t(t){var n;return(n=e.call(this,t)||this).macroLvl=0,n}a(t,e);var n=t.prototype;return n.scanDirective=function(e){var t=this._advanceToDirective(e);return[e0.if,e0.ifdef,e0.ifndef].includes(null==t?void 0:t.type)?this.macroLvl+=1:(null==t?void 0:t.type)===e0.endif&&(this.macroLvl-=1),t},n.scanWordsUntilChar=function(e){for(var t=[];;)if(this.skipSpace(!0),em.isLetter(this.getCurCharCode()))t.push(this.scanWord());else{if(this.getCurChar()===e)return this._advance(),t;this._advance()}},n.scanWord=function(e){if(void 0===e&&(e=!1),e)for(;!em.isLetter(this.getCurCharCode())&&!this.isEnd();)this._advance();else this.skipSpace(!0);if(this.isEnd())return ev;for(var t=this._currentIndex;em.isLetter(this.getCurCharCode())&&!this.isEnd();)this._advance();var n=this._currentIndex,r=this._source.slice(t,n);n===t&&this.throwError(this.getShaderPosition(0),"no word found.");var i=e1.get(r);if(i){var a=eg.pool.get();return a.set(i,r,this.getShaderPosition(0)),a}var o=eg.pool.get();return o.set(eZ.id,r,this.getShaderPosition(r.length)),o},n.getShaderPosition=function(e){return t_.createPosition(this._currentIndex-e)},n.scanToken=function(e){if(this.skipCommentsAndSpace(),!this.isEnd()){for(var t=this._source,n=this._currentIndex,r=!1,i=t.length;this._currentIndex<i;)if(em.isPpCharactors(t.charCodeAt(this._currentIndex)))this._advance(),r=!0;else{if(r)break;this._advance(),this.skipCommentsAndSpace(),n=this._currentIndex}var a=t.slice(n,this._currentIndex),o=eg.pool.get(),s=e1.get(a);return o.set(null!=s?s:eZ.id,a,this.getShaderPosition(this._currentIndex-n)),null==e||e(o,this),o}},n.scanQuotedString=function(){this.skipSpace(!0),'"'!==this.getCurChar()&&this.throwError(this.getShaderPosition(0),"unexpected char, expected '\"'");var e=this.getShaderPosition(0);this._advance();for(var t=this._currentIndex;'"'!==this.getCurChar()&&!this.isEnd();)this._advance();this.isEnd()&&this.throwError(this.getShaderPosition(0),"unexpected char, expected '\"'");var n=this._source.slice(t,this._currentIndex),r=eg.pool.get();return r.set(eZ.string_const,n,e),r},n.scanToChar=function(e){for(var t=this._source;t[this._currentIndex]!==e&&!this.isEnd();)this._advance()},n.scanMacroBranchChunk=function(){for(var e=this._currentIndex,t=this.getShaderPosition(0),n=this.macroLvl,r=this.scanDirective();(r.type!==e0.endif||n-1!==this.macroLvl)&&(![e0.elif,e0.else].includes(r.type)||n!==this.macroLvl);)r=this.scanDirective();var i=this._source.slice(e,this._currentIndex-r.lexeme.length-1),a=eg.pool.get();return a.set(eZ.chunk,i,t),{token:a,nextDirective:r}},n.scanPairedBlock=function(e,t){this.scanToChar(e);var n=0,r=this._source;do{var i=r[this._currentIndex];i===e?n++:i===t&&n--,this._advance()}while(n>0)},n.scanRemainMacro=function(){for(var e=this.macroLvl,t=this.scanDirective();!this.isEnd()&&(t.type!==e0.endif||e-1!==this.macroLvl);)t=this.scanDirective();return this.getShaderPosition(0)},n.peekNonSpace=function(){for(var e=this._currentIndex;/\s/.test(this._source[e]);)e+=1;return this._source[e]},n.scanInteger=function(){for(var e=this._currentIndex;em.isNum(this.getCurCharCode());)this._advance();this._currentIndex===e&&this.throwError(this.getShaderPosition(0),"no integer found");var t=this._source.slice(e,this._currentIndex),n=eg.pool.get();return n.set(eZ.int_constant,t,this.getShaderPosition(0)),n},n.scanLineRemain=function(){this.skipSpace(!1);for(var e=this._currentIndex,t=[];"\n"!==this.getCurChar();){if(this.isEnd()){var n=this._source.slice(e,this._currentIndex),r=eg.pool.get();return r.set(eZ.line_remain,n,this.getShaderPosition(n.length)),r}this._advance();var i=this._skipComments();i&&(i.start.index-=e,i.end.index-=e,t.push(i))}var a=this._source.slice(e,this._currentIndex);t.length&&(a=e2.assembleSegments(t.map(function(e){return{range:e,replace:""}}),a));var o=eg.pool.get();return o.set(eZ.line_remain,a,this.getShaderPosition(a.length)),o},n._advanceToDirective=function(e){for(;;){var t=this.scanToken(e);if(null==t?void 0:t.lexeme.startsWith("#"))return t;if(this.isEnd())return}},n._skipComments=function(){if("//"===this.peek(2)){for(var e=this.getShaderPosition(0);"\n"!==this.getCurChar()&&!this.isEnd();)this._advance();return t_.createRange(e,this.getCurPosition())}if("/*"===this.peek(2)){var t=this.getShaderPosition(0);for(this.advance(2);"*/"!==this.peek(2)&&!this.isEnd();)this._advance();return this.advance(2),t_.createRange(t,this.getShaderPosition(0))}},t}(eT),e4=/*#__PURE__*/function(){function e(){}return e.reset=function(e,t){this._definedMacros.clear(),this._expandSegmentsStack.length=0,this._expandSegmentsStack.push([]),this._branchMacros.clear(),this.addPredefinedMacro("GL_ES"),this._includeMap=e,this._basePathForIncludeKey=t},e.addPredefinedMacro=function(e,t){var n,r=eg.pool.get();r.set(eZ.id,e),t&&(n=eg.pool.get()).set(eZ.id,t),this._definedMacros.set(e,new e$(r,n))},e.parse=function(e){for(;!e.isEnd();){var t=e.scanDirective(this._onToken.bind(this));if(e.isEnd())break;switch(t.type){case e0.define:this._parseDefine(e);break;case e0.undef:this._parseUndef(e);break;case e0.if:this._parseIf(e);break;case e0.ifndef:this._parseIfNdef(e);break;case e0.ifdef:this._parseIfDef(e);break;case e0.include:this._parseInclude(e)}}return e2.expand(this.expandSegments,e.source,e.sourceMap)},e.reportError=function(e,t,n,r){eS.createGSError(t,eE.PreprocessorError,n,e,r)},e._parseInclude=function(e){var n,r=e.getShaderPosition(8);e.skipSpace(!0);var i=e.scanQuotedString();n="."!==i.lexeme[0]?i.lexeme:new URL(i.lexeme,this._basePathForIncludeKey).href.substring(t.ShaderPass._shaderRootPath.length),e.scanToChar("\n");var a=e.getShaderPosition(0),o=this._includeMap[n];if(!o){this.reportError(i.location,'Shader slice "'+n+'" not founded.',e.source,e.file);return}var s=t_.createRange(r,a),c=this._expandMacroChunk(o,s,i.lexeme);this.expandSegments.push({rangeInBlock:s,replace:c.content})},e._parseIfDef=function(e){var t=e.current-6,n=e.scanWord();this._addEmptyReplace(e,t),this._branchMacros.add(n.lexeme);var r=this._definedMacros.get(n.lexeme);e.skipSpace(!0);var i=e.scanMacroBranchChunk(),a=i.token,o=i.nextDirective;if(r){var s=o.type===e0.endif?e.getShaderPosition(0):e.scanRemainMacro(),c=this._expandMacroChunk(a.lexeme,a.location,e),u=t_.createRange(a.location.start,s);this.expandSegments.push({rangeInBlock:u,replace:c.content});return}this.expandSegments.pop(),this._addEmptyReplace(e,t),this._parseMacroBranch(o.type,e)},e._parseMacroBranch=function(e,t){if(e!==e0.endif){var n=t.current;if(e===e0.else){var r=t.scanMacroBranchChunk().token,i=this._expandMacroChunk(r.lexeme,r.location,t),a=t_.createPosition(n),o=t_.createRange(a,t.getShaderPosition(0));this.expandSegments.push({rangeInBlock:o,replace:i.content})}else if(e===e0.elif){var s=this._parseConstantExpression(t),c=t.scanMacroBranchChunk(),u=c.token,l=c.nextDirective;if(s){var p=l.type===e0.endif?t.current:t.scanRemainMacro().index,h=this._expandMacroChunk(u.lexeme,u.location,t),d=t_.createPosition(n),_=t_.createPosition(p),f=t_.createRange(d,_);this.expandSegments.push({rangeInBlock:f,replace:h.content})}else{var S=t_.createPosition(n),g=t_.createPosition(t.current),v=t_.createRange(S,g);this.expandSegments.push({rangeInBlock:v,replace:""}),this._parseMacroBranch(l.type,t)}}}},e._parseConstantExpression=function(e){return e.skipSpace(!0),this._parseLogicalOrExpression(e)},e._parseLogicalOrExpression=function(e){var t=this._parseLogicalAndExpression(e),n=e.peek(2);if(n&&"||"===n){e.advance(2),e.skipSpace(!1);var r=this._parseLogicalOrExpression(e);return t||r}return t},e._parseLogicalAndExpression=function(e){var t=this._parseEqualityExpression(e),n=e.peek(2);if(n&&"&&"===n){e.advance(2),e.skipSpace(!1);var r=this._parseLogicalAndExpression(e);return t&&r}return t},e._parseEqualityExpression=function(e){var t=this._parseRelationalExpression(e),n=e.peek(2);if(n&&["==","!="].includes(n)){e.advance(2),e.skipSpace(!1);var r=this._parseEqualityExpression(e);switch(n){case"==":return t===r;case"!=":return t!==r}}return t},e._parseRelationalExpression=function(e){var t=this._parseShiftExpression(e),n=e.peek(2);if("="!==n[1]&&(n=n[0]),n&&[">","<",">=","<="].includes(n)){var r=e.getShaderPosition(0);e.advance(n.length),e.skipSpace(!1);var i=this._parseRelationalExpression(e);if((void 0===t?"undefined":eJ(t))!==(void 0===i?"undefined":eJ(i))&&"number"!=typeof t){this.reportError(r,"invalid operator in relation expression.",e.source,e.file);return}switch(n){case">":return t>i;case"<":return t<i;case">=":return t>=i;case"<=":return t<=i}}return t},e._parseShiftExpression=function(e){var t=this._parseAdditiveExpression(e),n=e.peek(2);if(n&&[">>","<<"].includes(n)){var r=e.getShaderPosition(0);e.advance(2),e.skipSpace(!1);var i=this._parseShiftExpression(e);if((void 0===t?"undefined":eJ(t))!==(void 0===i?"undefined":eJ(i))&&"number"!=typeof t){this.reportError(r,"invalid operator in shift expression.",e.source,e.file);return}switch(n){case">>":return t>>i;case"<<":return t<<i}}return t},e._parseAdditiveExpression=function(e){var t=this._parseMulticativeExpression(e);if([">","<"].includes(e.getCurChar())){var n=e.getShaderPosition(0);e.advance();var r=e.getCurChar();e.skipSpace(!1);var i=this._parseAdditiveExpression(e);if((void 0===t?"undefined":eJ(t))!==(void 0===i?"undefined":eJ(i))&&"number"!=typeof t)return this.reportError(n,"invalid operator.",e.source,e.file),!1;switch(r){case"+":return t+i;case"-":return t-i}}return t},e._parseMulticativeExpression=function(e){var t=this._parseUnaryExpression(e);if(e.skipSpace(!1),["*","/","%"].includes(e.getCurChar())){var n=e.getShaderPosition(0),r=e.getCurChar();e.skipSpace(!1);var i=this._parseMulticativeExpression(e);if((void 0===t?"undefined":eJ(t))!==(void 0===i?"undefined":eJ(i))&&"number"!=typeof t){this.reportError(n,"invalid operator.",e.source,e.file);return}switch(r){case"*":return t*i;case"/":return t/i;case"%":return t%i}}return t},e._parseUnaryExpression=function(e){var t=e.getCurChar();if(["+","-","!"].includes(t)){e.advance();var n=e.getShaderPosition(0),r=this._parseParenthesisExpression(e);switch(("!"===t&&"boolean"!=typeof r||"!"!==t&&"number"!=typeof r)&&this.reportError(n,"invalid operator.",e.source,e.file),t){case"+":return r;case"-":return-r;case"!":return!r}}return this._parseParenthesisExpression(e)},e._parseParenthesisExpression=function(e){if("("===e.getCurChar()){e._advance(),e.skipSpace(!1);var t=this._parseConstantExpression(e);return e.scanToChar(")"),e._advance(),t}return this._parseConstant(e)},e._parseConstant=function(e){if(em.isAlpha(e.getCurCharCode())){var t=e.scanWord();if(t.type===e0.defined){var n="("===e.peekNonSpace(),r=e.scanWord(!0);return n&&(e.scanToChar(")"),e._advance()),this._branchMacros.add(r.lexeme),!!this._definedMacros.get(r.lexeme)}var i=this._definedMacros.get(t.lexeme);if(!i||!i.body)return!1;i.isFunction&&this.reportError(t.location,"invalid function macro usage",e.source,e.file);var a=Number(i.body.lexeme);return Number.isInteger(a)||this.reportError(t.location,"invalid const macro: "+t.lexeme,e.source,e.file),this._branchMacros.add(t.lexeme),a}if(em.isNum(e.getCurCharCode()))return Number(e.scanInteger().lexeme);this.reportError(e.getShaderPosition(0),"invalid token: "+e.getCurChar(),e.source,e.file)},e._expandMacroChunk=function(e,t,n){this._expandSegmentsStack.push([]),r="string"==typeof n?new e3(e,n):new e3(e,n.file,t);var r,i=this.parse(r);return this._expandSegmentsStack.pop(),{content:i}},e._parseIfNdef=function(e){var t=e.current-7,n=e.scanWord();this._addEmptyReplace(e,t),this._branchMacros.add(n.lexeme);var r=this._definedMacros.get(n.lexeme),i=e.scanMacroBranchChunk(),a=i.token,o=i.nextDirective;if(!r){var s=o.type===e0.endif?e.getShaderPosition(0):e.scanRemainMacro(),c=this._expandMacroChunk(a.lexeme,a.location,e),u=t_.createRange(a.location.start,s);this.expandSegments.push({rangeInBlock:u,replace:c.content});return}this.expandSegments.pop(),this._addEmptyReplace(e,t),this._parseMacroBranch(o.type,e)},e._addEmptyReplace=function(e,t){var n=t_.createPosition(t),r=e.getCurPosition(),i=t_.createRange(n,r);this.expandSegments.push({rangeInBlock:i,replace:""})},e._parseIf=function(e){var t=e.current-3,n=this._parseConstantExpression(e);this._addEmptyReplace(e,t);var r=e.scanMacroBranchChunk(),i=r.token,a=r.nextDirective;if(n){var o=a.type===e0.endif?e.getShaderPosition(0):e.scanRemainMacro(),s=this._expandMacroChunk(i.lexeme,i.location,e),c=t_.createRange(i.location.start,o);this.expandSegments.push({rangeInBlock:c,replace:s.content});return}this.expandSegments.pop(),this._addEmptyReplace(e,t),this._parseMacroBranch(a.type,e)},e._parseDefine=function(e){var t,n=e.getShaderPosition(7),r=e.scanWord(),i=r.location.end;this._definedMacros.get(r.lexeme)&&r.lexeme.startsWith("GL_")&&this.reportError(r.location,"redefined macro: "+r.lexeme,e.source,e.file),"("===e.getCurChar()&&(t=e.scanWordsUntilChar(")"),i=e.getShaderPosition(0));var a=new e$(r,e.scanLineRemain(),t_.createRange(n,i),t);this._definedMacros.set(r.lexeme,a),this.expandSegments.push({rangeInBlock:t_.createRange(n,e.getCurPosition()),replace:""})},e._parseUndef=function(e){var t=e.current-6,n=e.scanWord(),r=t_.createPosition(t),i=t_.createRange(r,e.getCurPosition());this.expandSegments.push({rangeInBlock:i,replace:""}),this._definedMacros.delete(n.lexeme)},e._onToken=function(e,t){var n=this._definedMacros.get(e.lexeme);if(n){var r=n.body.lexeme;if(n.isFunction){t.scanToChar("("),t._advance();for(var i=[],a=1,o=t.current;;){if("("===t.getCurChar())a+=1;else if(")"===t.getCurChar()){if(0==(a-=1))break}else","===t.getCurChar()&&1===a&&(i.push(t.source.slice(o,t.current)),o=t.current+1);t._advance()}i.push(t.source.slice(o,t.current)),t._advance();var s=t_.createRange(e.location.start,t.getCurPosition());r=n.expandFunctionBody(i);var c=this._expandMacroChunk(r,s,t),u=t_.createRange(e.location.start,t.getCurPosition());this.expandSegments.push({rangeInBlock:u,replace:c.content})}else{var l=this._expandMacroChunk(r,e.location,t),p=t_.createRange(e.location.start,e.location.end);this.expandSegments.push({rangeInBlock:p,replace:l.content})}}},ex(e,null,[{key:"expandSegments",get:function(){return this._expandSegmentsStack[this._expandSegmentsStack.length-1]}}]),e}();e4._definedMacros=new Map,e4._expandSegmentsStack=[[]],e4._branchMacros=new Set;var e9=/*#__PURE__*/function(){function e(){}return e.reset=function(e,t){e4.reset(e,t)},e.process=function(e){return this.baseScanner=new e3(e),e4.parse(this.baseScanner)},e.addPredefinedMacro=function(e,t){e4.addPredefinedMacro(e,t)},e}(),e5=/*#__PURE__*/function(){function e(){}return e.unwrapNodeByType=function(t,n){var r=t.children[0];if(!ef(r,eg))return r.nt===n?r:e.unwrapNodeByType(r,n)},e.isTerminal=function(e){return e<eF.START},e}(),e6=/*#__PURE__*/function(){function e(){this.attributeList=[],this.attributeStructs=[],this._referencedAttributeList=Object.create(null),this._referencedGlobals=Object.create(null),this._referencedVaryingList=Object.create(null),this._referencedMRTList=Object.create(null)}var t=e.prototype;return t.reset=function(){this.attributeList.length=0,this.attributeStructs.length=0,this._referencedAttributeList=Object.create(null),this._referencedGlobals=Object.create(null),this._referencedVaryingList=Object.create(null),this._referencedMRTList=Object.create(null),this.mrtStruct=void 0},t.isAttributeStruct=function(e){return -1!==this.attributeStructs.findIndex(function(t){return t.ident.lexeme===e})},t.isVaryingStruct=function(e){var t,n;return(null==(n=this.varyingStruct)?void 0:null==(t=n.ident)?void 0:t.lexeme)===e},t.isMRTStruct=function(e){var t,n;return(null==(n=this.mrtStruct)?void 0:null==(t=n.ident)?void 0:t.lexeme)===e},t.referenceAttribute=function(e){if(!this._referencedAttributeList[e.lexeme]){var t=this.attributeList.find(function(t){return t.ident.lexeme===e.lexeme});if(!t)return eS.createGSError("referenced attribute not found: "+e.lexeme,eE.CompilationError,t_._processingPassText,e.location);this._referencedAttributeList[e.lexeme]=t}},t.referenceVarying=function(e){if(!this._referencedVaryingList[e.lexeme]){var t,n=null==(t=this.varyingStruct)?void 0:t.propList.find(function(t){return t.ident.lexeme===e.lexeme});if(!n)return eS.createGSError("referenced varying not found: "+e.lexeme,eE.CompilationError,t_._processingPassText,e.location);this._referencedVaryingList[e.lexeme]=n}},t.referenceMRTProp=function(e){if(!this._referencedMRTList[e.lexeme]){var t,n=null==(t=this.mrtStruct)?void 0:t.propList.find(function(t){return t.ident.lexeme===e.lexeme});if(!n)return eS.createGSError("referenced mrt not found: "+e.lexeme,eE.CompilationError,t_._processingPassText,e.location);this._referencedMRTList[e.lexeme]=n}},t.referenceGlobal=function(e,t){if(!this._referencedGlobals[e]){if(t===eR.FN){for(var n=this._passSymbolTable.getAllFnSymbols(e),r=0;r<n.length;r++){var i=0===r?e:e+r;this._referencedGlobals[i]=n[r]}return}var a=this._passSymbolTable.lookup(e,t);a&&(this._referencedGlobals[e]=a)}},e.reset=function(){this._singleton||(this._singleton=new e),this._singleton.reset()},ex(e,[{key:"passSymbolTable",get:function(){return this._passSymbolTable}}],[{key:"context",get:function(){return this._singleton}}]),e}(),e7=/*#__PURE__*/function(){function e(){this.array=[]}return e.prototype.dispose=function(){this.array.length=0},e}(),e8="GS_glFragColor",te=/*#__PURE__*/function(){function e(){}var n=e.prototype;return n.defaultCodeGen=function(t){var n=e._tmpArrayPool,i=n.get();i.dispose();for(var a,o=r(t);!(a=o()).done;){var s=a.value;ef(s,eg)?i.array.push(s.lexeme):i.array.push(s.codeGen(this))}return n.return(i),i.array.join(" ")},n.visitPostfixExpression=function(e){var t=e.children,n=t.length,r=e6.context;if(3===n){var i=t[0],a=t[2];return ef(a,eg)?r.isAttributeStruct(i.type)?(r.referenceAttribute(a),a.lexeme):r.isVaryingStruct(i.type)?(r.referenceVarying(a),a.lexeme):r.isMRTStruct(i.type)?(r.referenceMRTProp(a),a.lexeme):i.codeGen(this)+"."+a.lexeme:i.codeGen(this)+"."+a.codeGen(this)}if(4===n){var o=t[0],s=t[2],c=o.codeGen(this),u=s.codeGen(this);if("gl_FragData"===c){var l=this.getFragDataCodeGen(u);return r._referencedMRTList[l]=this.getReferencedMRTPropText(u,l),l}return c+"["+u+"]"}return this.defaultCodeGen(e.children)},n.visitVariableIdentifier=function(e){return ef(e.symbolInfo,eM)&&e.symbolInfo.isGlobalVariable&&e6.context.referenceGlobal(e.lexeme,eR.VAR),e.lexeme},n.visitFunctionCall=function(e){var t=e.children[0];if(ef(t.fnSymbol,eO)){e6.context.referenceGlobal(t.fnSymbol.ident,eR.FN);var n=t.children[2],r=t.fnSymbol.astNode.protoType.parameterList;if(ef(n,eu.FunctionCallParameterList)){for(var i=[],a=n.paramNodes,o=0;o<a.length;o++)e6.context.isAttributeStruct(r[o].typeInfo.typeLexeme)||e6.context.isVaryingStruct(r[o].typeInfo.typeLexeme)||i.push(a[o].codeGen(this));return t.fnSymbol.ident+"("+i.join(", ")+")"}}return this.defaultCodeGen(e.children)},n.visitStatementList=function(e){var t=e.children;return 1===t.length?t[0].codeGen(this):t[0].codeGen(this)+"\n"+t[1].codeGen(this)},n.visitSingleDeclaration=function(e){var t=e.typeSpecifier.type;return"string"==typeof t&&e6.context.referenceGlobal(t,eR.STRUCT),this.defaultCodeGen(e.children)},n.visitGlobalVariableDeclaration=function(e){var t=e.children,n=t[0];return ef(n,eu.FullySpecifiedType)&&n.typeSpecifier.isCustom&&e6.context.referenceGlobal(n.type,eR.STRUCT),this.defaultCodeGen(t)},n.visitDeclaration=function(e){var t=e6.context,n=e.children,r=n[0];if(ef(r,eu.InitDeclaratorList)){var i=r.typeInfo.typeLexeme;if(t.isVaryingStruct(i)||t.isMRTStruct(i))return""}return this.defaultCodeGen(n)},n.visitFunctionProtoType=function(e){return e6.context._curFn=e,this.defaultCodeGen(e.children)},n.visitFunctionDefinition=function(e){return e6.context._curFn=void 0,this.defaultCodeGen(e.children)},n.visitFunctionParameterList=function(e){var t=this;return e.parameterInfoList.filter(function(e){return!e6.context.isAttributeStruct(e.typeInfo.typeLexeme)&&!e6.context.isVaryingStruct(e.typeInfo.typeLexeme)}).map(function(e){return e.astNode.codeGen(t)}).join(", ")},n.visitFunctionHeader=function(e){var t=e.returnType.typeSpecifier.lexeme;return e6.context.isAttributeStruct(t)||e6.context.isVaryingStruct(t)?"void "+e.ident.lexeme+"(":this.defaultCodeGen(e.children)},n.visitJumpStatement=function(e){var t=e.children;if(t[0].type===eh.RETURN){var n=t[1];if(ef(n,eu.Expression)){var r,i,a,o,s=e5.unwrapNodeByType(n,eF.variable_identifier);if((null==s?void 0:s.typeInfo)===(null==(i=e6.context.varyingStruct)?void 0:null==(r=i.ident)?void 0:r.lexeme))return"";var c=e5.unwrapNodeByType(n,eF.function_call);if((null==c?void 0:c.type)===(null==(o=e6.context.varyingStruct)?void 0:null==(a=o.ident)?void 0:a.lexeme))return""+n.codeGen(this)+";"}}return this.defaultCodeGen(t)},n.visitFunctionIdentifier=function(e){return this.defaultCodeGen(e.children)},n._reportError=function(e,n){t.Logger.error(n)},e}();te._tmpArrayPool=new t.ReturnableObjectPool(e7,10);var tt=((ec={})[ec.VERTEX=0]="VERTEX",ec[ec.FRAGMENT=1]="FRAGMENT",ec[ec.ALL=2]="ALL",ec),tn=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._versionText="",t._extensions="",t._globalCodeArray=[],t}a(t,e);var n=t.prototype;return n.visitShaderProgram=function(e,t,n){return e6.reset(),e6.context._passSymbolTable=e.shaderData.symbolTable,{vertex:this.vertexMain(t,e.shaderData),fragment:this._fragmentMain(n,e.shaderData)}},n.vertexMain=function(e,t){var n=t.symbolTable,i=n.lookup(e,eR.FN);if(!(null==i?void 0:i.astNode))throw"no entry function found: "+e;var a=i.astNode;e6.context.stage=tt.VERTEX;var o=a.protoType.returnType;if("string"==typeof o.type){var s=n.lookup(o.type,eR.STRUCT);s?e6.context.varyingStruct=s.astNode:this._reportError(o.location,"invalid varying struct: "+o.type)}else o.type!==eh.VOID&&this._reportError(o.location,"vertex main entry can only return struct or void.");var c=a.protoType.parameterList;if(null==c?void 0:c.length)for(var u,l=r(c);!(u=l()).done;){var p=u.value;if("string"==typeof p.typeInfo.type){var h=n.lookup(p.typeInfo.type,eR.STRUCT);if(!h){this._reportError(p.astNode.location,'Not found attribute struct "'+p.typeInfo.type+'".');continue}e6.context.attributeStructs.push(h.astNode);for(var d,_=r(h.astNode.propList);!(d=_()).done;){var f=d.value;e6.context.attributeList.push(f)}}else e6.context.attributeList.push(p)}var S=a.statements.codeGen(this),g=this._globalCodeArray;g.length=0,this._getGlobalText(t,g),this.getAttributeDeclare(g),this.getVaryingDeclare(g);var v=g.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return e6.context.reset(),this._versionText+"\n"+v+"\n\nvoid main() "+S},n._fragmentMain=function(e,t){var n=t.symbolTable,r=n.lookup(e,eR.FN);if(!(null==r?void 0:r.astNode))throw"no entry function found: "+e;var i=r.astNode,a=i.returnStatement;a&&(a.isFragReturnStatement=!0);var o=e6.context;o.stage=tt.FRAGMENT;var s=i.protoType.returnType,c=s.type,u=s.location;if("string"==typeof c){var l=n.lookup(c,eR.STRUCT);l?o.mrtStruct=l.astNode:this._reportError(u,"invalid mrt struct: "+c)}else c!==eh.VOID&&c!==eh.VEC4&&this._reportError(u,"fragment main entry can only return struct or vec4.");var p=i.statements.codeGen(this),h=this._globalCodeArray;h.length=0,this._getGlobalText(t,h),this.getVaryingDeclare(h),this.getMRTDeclare(h);var d=h.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return o.reset(),this._versionText+"\n"+this._extensions+"\n\n#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n#else\n precision mediump float;\n precision mediump int;\n#endif\n\n"+d+"\n\nvoid main() "+p},n._getGlobalText=function(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=new Set);var a=e6.context._referencedGlobals;if(n===Object.keys(a).length){for(var o,s=r(e.globalPrecisions);!(o=s()).done;){var c=o.value;t.push({text:c.codeGen(this),index:c.location.start.index})}return t}for(var u in n=Object.keys(a).length,a){var l=a[u];i.has(u)||(i.add(u),ef(l,eI)?l.symbolType===eR.VAR?t.push({text:"uniform "+l.astNode.codeGen(this),index:l.astNode.location.start.index}):t.push({text:l.astNode.codeGen(this),index:l.astNode.location.start.index}):t.push({text:l.codeGen(this),index:l.location.start.index}))}return this._getGlobalText(e,t,n,i)},t}(te),tr=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._versionText="#version 100",t._extensions=["GL_EXT_shader_texture_lod","GL_OES_standard_derivatives","GL_EXT_draw_buffers","GL_EXT_frag_depth"].map(function(e){return"#extension "+e+" : enable\n"}).join(""),t}a(t,e);var n=t.prototype;return n.getFragDataCodeGen=function(e){return"gl_FragData["+e+"]"},n.getReferencedMRTPropText=function(e,t){return""},n.getAttributeDeclare=function(e){for(var t,n=r(Object.values(e6.context._referencedAttributeList));!(t=n()).done;){var i=t.value;e.push({text:"attribute "+i.typeInfo.typeLexeme+" "+i.ident.lexeme+";",index:i.ident.location.start.index})}},n.getVaryingDeclare=function(e){for(var t,n=r(Object.values(e6.context._referencedVaryingList));!(t=n()).done;){var i=t.value;e.push({text:"varying "+i.typeInfo.typeLexeme+" "+i.ident.lexeme+";",index:i.ident.location.start.index})}},n.getMRTDeclare=function(e){},n.visitPostfixExpression=function(t){var n=t.children,r=n[0],i=e6.context;if(ef(r,eu.PostfixExpression)&&i.isMRTStruct(r.type)){var a=n[2],o=i.mrtStruct.propList.find(function(e){return e.ident.lexeme===a.lexeme});return o?"gl_FragData["+o.mrtIndex+"]":(this._reportError(a.location,"not found mrt property: "+a.lexeme),"")}return e.prototype.visitPostfixExpression.call(this,t)},n.visitJumpStatement=function(t){return t.isFragReturnStatement?"gl_FragColor = "+t.children[1].codeGen(this):e.prototype.visitJumpStatement.call(this,t)},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(tn),ti=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._versionText="#version 300 es",t}a(t,e);var n=t.prototype;return n.getFragDataCodeGen=function(e){return"GS_glFragData_"+e},n.getReferencedMRTPropText=function(e,t){return"layout(location = "+e+") out vec4 "+t+";"},n.getAttributeDeclare=function(e){for(var t,n=r(Object.values(e6.context._referencedAttributeList));!(t=n()).done;){var i=t.value;e.push({text:"in "+i.typeInfo.typeLexeme+" "+i.ident.lexeme+";",index:i.ident.location.start.index})}},n.getVaryingDeclare=function(e){for(var t=e6.context.stage===tt.FRAGMENT?"in":"out",n=Object.values(e6.context._referencedVaryingList),r=0;r<n.length;r++){var i,a=n[r];e.push({text:(null!=(i=a.qualifier)?i:t)+" "+a.typeInfo.typeLexeme+" "+a.ident.lexeme+";",index:a.ident.location.start.index})}},n.getMRTDeclare=function(e){var t=e6.context._referencedMRTList;for(var n in t){var r=t[n];"string"==typeof r?e.push({text:r,index:Number.MAX_SAFE_INTEGER}):e.push({text:this.getReferencedMRTPropText(r.mrtIndex,n),index:r.ident.location.start.index})}},n.visitFunctionIdentifier=function(e){var t=e.children;if(1!==t[0].children.length)return this.defaultCodeGen(t);var n=e.lexeme;if("texture2D"===e.ident||"textureCube"===e.ident)n="texture";else if("texture2DProj"===e.ident)n="textureProj";else if(e6.context.stage===tt.FRAGMENT)switch(e.ident){case"texture2DLodEXT":case"textureCubeLodEXT":n="textureLod";break;case"texture2DGradEXT":case"textureCubeGradEXT":n="textureGrad";break;case"texture2DProjLodEXT":n="textureProjLod";break;case"texture2DProjGradEXT":n="textureProjGrad";break;case"gl_FragDepthEXT":n="gl_FragDepth"}return n},n.visitVariableIdentifier=function(t){return e6.context.stage===tt.FRAGMENT&&"gl_FragColor"===t.lexeme?(this._registerFragColorVariable(t),e8):e.prototype.visitVariableIdentifier.call(this,t)},n.visitJumpStatement=function(t){return t.isFragReturnStatement?e6.context.mrtStruct?"":(this._registerFragColorVariable(t),e8+" = "+t.children[1].codeGen(this)+";"):e.prototype.visitJumpStatement.call(this,t)},n._registerFragColorVariable=function(e){var t=e6.context._referencedVaryingList;if(!t[e8]){var n=eg.pool.get();n.set(e_.ID,e8,t_.createPosition(0,0,0)),t[e8]={ident:n,typeInfo:new eU(eh.VEC4,"vec4"),qualifier:"out",astNode:e}}},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(tn);function ta(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ta=function(){return!!e})()}function to(e,t,n){return(to=ta()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&i(a,n.prototype),a}).apply(null,arguments)}function ts(){return(ts=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var tc=new Map([["RenderQueueType",eh.GS_RenderQueueType],["BlendState",eh.GS_BlendState],["DepthState",eh.GS_DepthState],["StencilState",eh.GS_StencilState],["RasterState",eh.GS_RasterState],["EditorProperties",eh.GS_EditorProperties],["EditorMacros",eh.GS_EditorMacros],["Editor",eh.GS_Editor],["Tags",eh.GS_Tags],["VertexShader",eh.GS_VertexShader],["FragmentShader",eh.GS_FragmentShader],["SubShader",eh.GS_SubShader],["Pass",eh.GS_Pass],["BlendFactor",eh.GS_BlendFactor],["BlendOperation",eh.GS_BlendOperation],["Bool",eh.GS_Bool],["Number",eh.GS_Number],["CompareFunction",eh.GS_CompareFunction],["StencilOperation",eh.GS_StencilOperation],["CullMode",eh.GS_CullMode],["true",eh.TRUE],["false",eh.FALSE],["UsePass",eh.GS_UsePass],["Color",eh.GS_Color]]),tu=/*#__PURE__*/function(e){function t(t,n){return void 0===n&&(n=new Map),e.call(this,t,n)||this}a(t,e);var n=t.prototype;return n.scanWord=function(){this.skipCommentsAndSpace();for(var e=this._currentIndex;/\S/.test(this.getCurChar())&&!this.isEnd();)this._advance();return this._source.substring(e,this._currentIndex)},n.scanNumber=function(){this.skipCommentsAndSpace();for(var e=this._currentIndex;/[0-9]/.test(this.getCurChar());)this._advance();if("."===this.getCurChar())for(this._advance();/[0-9]/.test(this.getCurChar());)this._advance();return Number(this._source.substring(e,this._currentIndex))},t}(eT),tl=/*#__PURE__*/function(e){function n(){return e.apply(this,arguments)||this}a(n,e);var r=n.prototype;return r.insert=function(e){for(var n,r=null!=(n=this._table.get(e.ident))?n:[],i=0;i<r.length;i++)if(r[i].type===e.type){t.Logger.warn("replace symbol:",e.ident),r[i]=e;return}r.push(e),this._table.set(e.ident,r)},r.lookup=function(e,t){var n=this._table.get(e);if(n)for(var r=n.length,i=0;i<r;i++){var a=n[i];if(a.type===t)return a}},n}(ek),tp=[eh.GS_RenderQueueType,eh.GS_BlendFactor,eh.GS_BlendOperation,eh.GS_Bool,eh.GS_Number,eh.GS_Color,eh.GS_CompareFunction,eh.GS_StencilOperation,eh.GS_CullMode],th=[eh.GS_BlendState,eh.GS_DepthState,eh.GS_RasterState,eh.GS_StencilState],td=/*#__PURE__*/function(){function e(){}return e.reset=function(){this._errors.length=0,this._symbolTableStack.clear(),this._newScope()},e.parse=function(e){var n=performance.now(),r=new tu(e,tc),i={subShaders:[],globalContents:[],renderStates:{constantMap:{},variableMap:{}}};r.scanText("Shader"),i.name=r.scanPairedText('"','"'),r.scanText("{"),r.skipCommentsAndSpace(),this._parseShaderStatements(i,r);for(var a=i.globalContents,o=i.renderStates,s=0;s<i.subShaders.length;s++)for(var c=i.subShaders[s],u=a.concat(c.globalContents),l=ts({},o.constantMap,c.renderStates.constantMap),p=ts({},o.variableMap,c.renderStates.variableMap),h=0;h<c.passes.length;h++){var d=c.passes[h];if(Object.assign(d.renderStates.constantMap,l),Object.assign(d.renderStates.variableMap,p),!d.isUsePass){var _=u.concat(d.globalContents);d.contents=_.map(function(e){return e.content}).join("\n")}}return t.Logger.info("[content compilation] cost time "+(performance.now()-n)+"ms"),i},e._isRenderStateDeclarator=function(e){return th.includes(e.type)},e._isEngineType=function(e){return tp.includes(e.type)},e._lookupSymbolByType=function(t,n){for(var r=e._symbolTableStack.stack,i=r.length,a=i-1;a>=0;a--){var o=r[a].lookup(t,n);if(o)return o}},e._parseShaderStatements=function(t,n){for(var r=1,i=n.getCurPosition();;){var a=n.scanToken();switch(a.type){case eh.GS_SubShader:this._addGlobalStatement(t,n,i,a.lexeme.length);var o=this._parseSubShader(n);t.subShaders.push(o),i=n.getCurPosition();break;case eh.GS_EditorProperties:case eh.GS_EditorMacros:case eh.GS_Editor:this._addGlobalStatement(t,n,i,a.lexeme.length),n.scanPairedText("{","}",!0),i=n.getCurPosition();break;case eh.GS_RenderQueueType:this._addGlobalStatement(t,n,i,a.lexeme.length),this._parseRenderQueueAssignment(t,n),i=n.getCurPosition();break;case e_.NOT_WORD:if("{"===a.lexeme)r+=1;else if("}"===a.lexeme&&0==(r-=1)){this._addGlobalStatement(t,n,i,a.lexeme.length),this._symbolTableStack.dropScope();return}default:if(e._isRenderStateDeclarator(a)){this._addGlobalStatement(t,n,i,a.lexeme.length),this._parseRenderStateDeclarationOrAssignment(t,a,n),i=n.getCurPosition();break}e._isEngineType(a)&&(this._addGlobalStatement(t,n,i,a.lexeme.length),this._parseVariableDeclaration(a.type,n),i=n.getCurPosition())}}},e._parseRenderStateDeclarationOrAssignment=function(t,n,r){var i,a=r.scanToken();if(a.type===e_.ID)i=!0,r.scanText("{");else if("{"===a.lexeme)i=!1;else if("="===a.lexeme){var o=r.scanToken();r.scanText(";");var s=e._lookupSymbolByType(o.lexeme,n.type);(null==s?void 0:s.value)||eS.createGSError('Invalid "'+n.lexeme+'" variable: '+o.lexeme,eE.CompilationError,r.source,o.location);var c=s.value;Object.assign(t.renderStates.constantMap,c.constantMap),Object.assign(t.renderStates.variableMap,c.variableMap);return}var u=this._parseRenderStatePropList(n.lexeme,r);i?this._symbolTableStack.insert({ident:a.lexeme,type:n.type,value:u}):(Object.assign(t.renderStates.constantMap,u.constantMap),Object.assign(t.renderStates.variableMap,u.variableMap))},e._parseVariableDeclaration=function(e,t){var n=t.scanToken();t.scanText(";"),this._symbolTableStack.insert({type:n.type,ident:n.lexeme})},e._newScope=function(){var e=new tl;this._symbolTableStack.newScope(e)},e._dropScope=function(){this._symbolTableStack.dropScope()},e._parseRenderStatePropList=function(e,t){for(var n={constantMap:{},variableMap:{}};"}"!==t.getCurChar();)this._parseRenderStatePropItem(n,e,t),t.skipCommentsAndSpace();return t._advance(),n},e._parseRenderStatePropItem=function(n,r,i){var a=i.scanToken().lexeme,o=i.scanToken();if("BlendState"===r&&"BlendColor"!==a&&"AlphaToCoverage"!==a){var s=0;"["===o.lexeme?(s=i.scanNumber(),i.scanText("]"),i.scanText("=")):"="!==o.lexeme&&eS.createGSError("Invalid syntax, expect character '=', but got "+o.lexeme,eE.CompilationError,i.source,i.getCurPosition()),a+=s}a=r+a;var c=t.RenderStateDataKey[a];if(void 0==c&&eS.createGSError("Invalid render state element "+a,eE.CompilationError,i.source,i.getCurPosition()),i.skipCommentsAndSpace(),/[0-9.]/.test(i.getCurChar()))p=i.scanNumber();else{var u=i.scanToken();if(u.type===eh.TRUE)p=!0;else if(u.type===eh.FALSE)p=!1;else if(u.type===eh.GS_Color){i.scanText("(");for(var l=[];;){if(l.push(i.scanNumber()),i.skipCommentsAndSpace(),")"===i.peek(1)){i._advance();break}i.scanText(",")}p=to(t.Color,[].concat(l))}else if("."===i.getCurChar()){i._advance();var p,h,d=i.scanToken();void 0==(p=null==(h=e._engineType[u.lexeme])?void 0:h[d.lexeme])&&eS.createGSError("Invalid engine constant: "+u.lexeme+"."+d.lexeme,eE.CompilationError,i.source,d.location)}else p=u.lexeme}i.scanText(";"),"string"==typeof p?n.variableMap[c]=p:n.constantMap[c]=p},e._parseRenderQueueAssignment=function(n,r){r.scanText("=");var i=r.scanToken();r.scanText(";");var a=e._engineType.RenderQueueType[i.lexeme],o=t.RenderStateDataKey.RenderQueueType;void 0==a?n.renderStates.variableMap[o]=i.lexeme:n.renderStates.constantMap[o]=a},e._addGlobalStatement=function(e,t,n,r){t.current>n.index+r&&e.globalContents.push({range:{start:n,end:ts({},t.getCurPosition(),{index:t.current-r-1})},content:t.source.substring(n.index,t.current-r-1)})},e._parseSubShader=function(t){this._newScope();var n={passes:[],globalContents:[],renderStates:{constantMap:{},variableMap:{}},tags:{}},r=1;n.name=t.scanPairedText('"','"'),t.scanText("{"),t.skipCommentsAndSpace();for(var i=t.getCurPosition();;){var a=t.scanToken();switch(a.type){case eh.GS_Pass:this._addGlobalStatement(n,t,i,a.lexeme.length);var o=this._parsePass(t);n.passes.push(o),i=t.getCurPosition();break;case eh.GS_RenderQueueType:this._addGlobalStatement(n,t,i,a.lexeme.length),this._parseRenderQueueAssignment(n,t),i=t.getCurPosition();break;case eh.GS_UsePass:this._addGlobalStatement(n,t,i,a.lexeme.length);var s=t.scanPairedText('"','"');n.passes.push({name:s,isUsePass:!0,renderStates:{constantMap:{},variableMap:{}},tags:{}}),i=t.getCurPosition();break;case eh.GS_Tags:this._addGlobalStatement(n,t,i,a.lexeme.length),this._parseTags(n,t),i=t.getCurPosition();break;case e_.NOT_WORD:if("{"===a.lexeme)r+=1;else if("}"===a.lexeme&&0==(r-=1))return this._addGlobalStatement(n,t,i,a.lexeme.length),this._dropScope(),n;default:if(e._isRenderStateDeclarator(a)){this._addGlobalStatement(n,t,i,a.lexeme.length),this._parseRenderStateDeclarationOrAssignment(n,a,t),i=t.getCurPosition();break}e._isEngineType(a)&&(this._addGlobalStatement(n,t,i,a.lexeme.length),this._parseVariableDeclaration(a.type,t),i=t.getCurPosition())}}},e._parseTags=function(e,t){for(t.scanText("{");;){var n=t.scanToken();t.scanText("=");var r=t.scanPairedText('"','"');if(t.skipCommentsAndSpace(),e.tags[n.lexeme]=r,"}"===t.peek(1)){t._advance();return}t.scanText(",")}},e._parsePass=function(t){this._newScope();var n={globalContents:[],renderStates:{constantMap:{},variableMap:{}},tags:{}};n.name=t.scanPairedText('"','"'),t.scanText("{");var r=1;t.skipCommentsAndSpace();for(var i=t.getCurPosition();;){var a=t.scanToken();switch(a.type){case eh.GS_RenderQueueType:this._addGlobalStatement(n,t,i,a.lexeme.length),this._parseRenderQueueAssignment(n,t),i=t.getCurPosition();break;case eh.GS_Tags:this._addGlobalStatement(n,t,i,a.lexeme.length),this._parseTags(n,t),i=t.getCurPosition();break;case eh.GS_VertexShader:case eh.GS_FragmentShader:this._addGlobalStatement(n,t,i,a.lexeme.length),t.scanText("=");var o=t.scanToken();n[a.lexeme]&&eS.createGSError("reassign main entry",eE.CompilationError,t.source,t.getCurPosition()),n[a.type===eh.GS_VertexShader?"vertexEntry":"fragmentEntry"]=o.lexeme,t.scanText(";"),i=t.getCurPosition();break;case e_.NOT_WORD:if("{"===a.lexeme)r+=1;else if("}"===a.lexeme&&0==(r-=1))return this._addGlobalStatement(n,t,i,a.lexeme.length),this._dropScope(),n;default:if(e._isRenderStateDeclarator(a)){this._addGlobalStatement(n,t,i,a.lexeme.length),this._parseRenderStateDeclarationOrAssignment(n,a,t),i=t.getCurPosition();break}e._isEngineType(a)&&(this._addGlobalStatement(n,t,i,a.lexeme.length),this._parseVariableDeclaration(a.type,t),i=t.getCurPosition())}}},e}();td._engineType={RenderQueueType:t.RenderQueueType,CompareFunction:t.CompareFunction,StencilOperation:t.StencilOperation,BlendOperation:t.BlendOperation,BlendFactor:t.BlendFactor,CullMode:t.CullMode},td._errors=[],td._symbolTableStack=new eN;var t_=/*#__PURE__*/function(){function e(){}var n=e.prototype;return n._parseShaderPass=function(n,i,a,o,s,c,u){e9.reset(t.ShaderLib,u);for(var l,p=r(o);!(l=p()).done;){var h=l.value;e9.addPredefinedMacro(h.name,h.value)}for(var d=0;d<c.length;d++)e9.addPredefinedMacro(c[d]);var _=performance.now(),f=e9.process(n);t.Logger.info("[pass compilation - preprocessor] cost time "+(performance.now()-_)+"ms");var S=new eC(f).tokenize(),g=e._parser;e._processingPassText=f;var v=g.parse(S);if(v){var m=s===t.ShaderPlatformTarget.GLES100?tr.getVisitor():ti.getVisitor(),y=performance.now(),x=m.visitShaderProgram(v,i,a);return t.Logger.info("[CodeGen] cost time: "+(performance.now()-y)+"ms"),e._processingPassText=void 0,x}},n._parseShaderContent=function(e){return eS.clearAllShaderLabObjectPool(),td.reset(),td.parse(e)},e.createPosition=function(e,t,n){var r=this._shaderPositionPool.get();return r.set(e),r},e.createRange=function(e,t){var n=this._shaderRangePool.get();return n.set(e,t),n},e}();t_._parser=eY.create(),t_._shaderPositionPool=eS.createObjectPool(ep),t_._shaderRangePool=eS.createObjectPool(el);var tf="1.4.0-beta.2";console.log("Galacean ShaderLab version: "+tf+". mode: Release"),e.ShaderLab=t_,e.version=tf,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=browser.min.js.map
|
package/dist/browser.verbose.js
CHANGED
|
@@ -8058,7 +8058,7 @@
|
|
|
8058
8058
|
ShaderLab._shaderRangePool = ShaderLabUtils.createObjectPool(ShaderRange);
|
|
8059
8059
|
|
|
8060
8060
|
//@ts-ignore
|
|
8061
|
-
var version = "1.4.0-beta.
|
|
8061
|
+
var version = "1.4.0-beta.2";
|
|
8062
8062
|
var mode = "Release";
|
|
8063
8063
|
mode = "Verbose";
|
|
8064
8064
|
console.log("Galacean ShaderLab version: " + version + ". mode: " + mode);
|