1 | {"version":3,"file":"MultisampleSystem.js","sources":["../../src/framebuffer/MultisampleSystem.ts"],"sourcesContent":["import { MSAA_QUALITY } from '@pixi/constants';\nimport { extensions, ExtensionType } from '@pixi/extensions';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderingContext } from '../IRenderer';\nimport type { Renderer } from '../Renderer';\nimport type { ISystem } from '../system/ISystem';\n\n/**\n * System that manages the multisample property on the WebGL renderer\n * @memberof PIXI\n */\nexport class MultisampleSystem implements ISystem\n{\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: ExtensionType.RendererSystem,\n name: '_multisample',\n };\n\n /**\n * The number of msaa samples of the canvas.\n * @readonly\n */\n public multisample: MSAA_QUALITY;\n\n private renderer: Renderer;\n\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n protected contextChange(gl: IRenderingContext): void\n {\n let samples;\n\n if (this.renderer.context.webGLVersion === 1)\n {\n const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n }\n else\n {\n const framebuffer = gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebuffer);\n }\n\n if (samples >= MSAA_QUALITY.HIGH)\n {\n this.multisample = MSAA_QUALITY.HIGH;\n }\n else if (samples >= MSAA_QUALITY.MEDIUM)\n {\n this.multisample = MSAA_QUALITY.MEDIUM;\n }\n else if (samples >= MSAA_QUALITY.LOW)\n {\n this.multisample = MSAA_QUALITY.LOW;\n }\n else\n {\n this.multisample = MSAA_QUALITY.NONE;\n }\n }\n\n destroy(): void\n {\n // ka boom!\n }\n}\n\nextensions.add(MultisampleSystem);\n"],"names":["MSAA_QUALITY","ExtensionType","extensions"],"mappings":";;AAYO,MAAM,kBACb;AAAA,EAeI,YAAY,UACZ;AACI,SAAK,WAAW;AAAA,EACpB;AAAA,EAEU,cAAc,IACxB;AACQ,QAAA;AAEJ,QAAI,KAAK,SAAS,QAAQ,iBAAiB,GAC3C;AACI,YAAM,cAAc,GAAG,aAAa,GAAG,mBAAmB;AAE1D,SAAG,gBAAgB,GAAG,aAAa,IAAI,GAEvC,UAAU,GAAG,aAAa,GAAG,OAAO,GAEpC,GAAG,gBAAgB,GAAG,aAAa,WAAW;AAAA,IAAA,OAGlD;AACI,YAAM,cAAc,GAAG,aAAa,GAAG,wBAAwB;AAE/D,SAAG,gBAAgB,GAAG,kBAAkB,IAAI,GAE5C,UAAU,GAAG,aAAa,GAAG,OAAO,GAEpC,GAAG,gBAAgB,GAAG,kBAAkB,WAAW;AAAA,IACvD;AAEI,eAAWA,uBAAa,OAExB,KAAK,cAAcA,UAAAA,aAAa,OAE3B,WAAWA,UAAAA,aAAa,SAE7B,KAAK,cAAcA,uBAAa,SAE3B,WAAWA,uBAAa,MAE7B,KAAK,cAAcA,UAAa,aAAA,MAIhC,KAAK,cAAcA,UAAAA,aAAa;AAAA,EAExC;AAAA,EAEA,UACA;AAAA,EAEA;AACJ;AApEa,kBAGF,YAA+B;AAAA,EAClC,MAAMC,WAAc,cAAA;AAAA,EACpB,MAAM;AACV;AAgEJC,WAAAA,WAAW,IAAI,iBAAiB;;"} |