@pixi/core
Version:
Core PixiJS
1 lines • 1.76 kB
Source Map (JSON)
{"version":3,"file":"getAttributeData.mjs","sources":["../../../src/shader/utils/getAttributeData.ts"],"sourcesContent":["import { mapSize } from './mapSize';\nimport { mapType } from './mapType';\n\nimport type { IAttributeData } from '../Program';\n\n/**\n * returns the attribute data from the program\n * @private\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n * @returns {object} the attribute data for this program\n */\nexport function getAttributeData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IAttributeData}\n{\n const attributes: {[key: string]: IAttributeData} = {};\n\n const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (let i = 0; i < totalAttributes; i++)\n {\n const attribData = gl.getActiveAttrib(program, i);\n\n if (attribData.name.startsWith('gl_'))\n {\n continue;\n }\n\n const type = mapType(gl, attribData.type);\n const data = {\n type,\n name: attribData.name,\n size: mapSize(type),\n location: gl.getAttribLocation(program, attribData.name),\n };\n\n attributes[attribData.name] = data;\n }\n\n return attributes;\n}\n"],"names":[],"mappings":";;AAYgB,SAAA,iBAAiB,SAAuB,IACxD;AACU,QAAA,aAA8C,CAE9C,GAAA,kBAAkB,GAAG,oBAAoB,SAAS,GAAG,iBAAiB;AAE5E,WAAS,IAAI,GAAG,IAAI,iBAAiB,KACrC;AACI,UAAM,aAAa,GAAG,gBAAgB,SAAS,CAAC;AAE5C,QAAA,WAAW,KAAK,WAAW,KAAK;AAEhC;AAGJ,UAAM,OAAO,QAAQ,IAAI,WAAW,IAAI,GAClC,OAAO;AAAA,MACT;AAAA,MACA,MAAM,WAAW;AAAA,MACjB,MAAM,QAAQ,IAAI;AAAA,MAClB,UAAU,GAAG,kBAAkB,SAAS,WAAW,IAAI;AAAA,IAAA;AAGhD,eAAA,WAAW,IAAI,IAAI;AAAA,EAClC;AAEO,SAAA;AACX;"}