{"version":3,"file":"maxRecommendedTextures.mjs","sources":["../../../../../src/rendering/batcher/gl/utils/maxRecommendedTextures.ts"],"sourcesContent":["import { getTestContext } from '../../../renderers/gl/shader/program/getTestContext';\nimport { checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader';\n\nlet maxTexturesPerBatchCache: number | null = null;\n\n/**\n * Returns the maximum number of textures that can be batched. This uses WebGL1's `MAX_TEXTURE_IMAGE_UNITS`.\n * The response for this is that to get this info via WebGPU, we would need to make a context, which\n * would make this function async, and we want to avoid that.\n * @private\n * @deprecated Use `Renderer.limits.maxBatchableTextures` instead.\n * @returns {number} The maximum number of textures that can be batched\n */\nexport function getMaxTexturesPerBatch(): number\n{\n    if (maxTexturesPerBatchCache) return maxTexturesPerBatchCache;\n\n    const gl = getTestContext();\n\n    // step 1: first check max textures the GPU can handle.\n    maxTexturesPerBatchCache = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n\n    // step 2: check the maximum number of if statements the shader can have too..\n    maxTexturesPerBatchCache = checkMaxIfStatementsInShader(\n        maxTexturesPerBatchCache, gl);\n\n    gl.getExtension('WEBGL_lose_context')?.loseContext();\n\n    return maxTexturesPerBatchCache;\n}\n"],"names":[],"mappings":";;;;AAGA,IAAI,wBAAA,GAA0C,IAAA;AAUvC,SAAS,sBAAA,GAChB;AACI,EAAA,IAAI,0BAA0B,OAAO,wBAAA;AAErC,EAAA,MAAM,KAAK,cAAA,EAAe;AAG1B,EAAA,wBAAA,GAA2B,EAAA,CAAG,YAAA,CAAa,EAAA,CAAG,uBAAuB,CAAA;AAGrE,EAAA,wBAAA,GAA2B,4BAAA;AAAA,IACvB,wBAAA;AAAA,IAA0B;AAAA,GAAE;AAEhC,EAAA,EAAA,CAAG,YAAA,CAAa,oBAAoB,CAAA,EAAG,WAAA,EAAY;AAEnD,EAAA,OAAO,wBAAA;AACX;;;;"}