Repository: pixijs/pixijs
File: src/rendering/renderers/gpu/pipeline/PipelineSystem.ts (TypeScript)

Code before:
        const keyGen = [];
        let index = 0;
        // generate a key..

        const attributeKeys = Object.keys(program.attributeData).sort();

        for (let i = 0; i < attributeKeys.length; i++)
        {
            const attribute = program.attributeData[attributeKeys[i]];

            keyGen[index++] = attribute.location;
        }

        const stringKey = keyGen.join('|');

        program._attributeLocationsKey = createIdFromString(stringKey, 'programAttributes');

        return program._attributeLocationsKey;
    }

    /**
     * returns a hash of buffer names mapped to bind locations.
     * This is used to bind the correct buffer to the correct location in the shader.
     * @param geometry - The geometry to get the buffer names for
     * @param program - The program to get the buffer names for
     * @returns a object of buffer names mapped to the bind location
     */
    public getBufferNamesToBind(geometry: Geometry, program: GpuProgram): Record<string, string>
    {
        const key = (geometry._layoutKey << 16) | program._attributeLocationsKey;

        if (this._bindingNamesCache[key]) return this._bindingNamesCache[key];

        const data = this._createVertexBufferLayouts(geometry, program);

        // now map the data to the buffers..
        const bufferNamesToBind: Record<string, string> = Object.create(null);

        const attributeData = program.attributeData;

        for (let i = 0; i < data.length; i++)
        {
            for (const j in attributeData)
            {
                if (attributeData[j].location === i)
                {
                    bufferNamesToBind[i] = j;
                    break;
                }
            }
        }

Review comment (suggestion):
```suggestion
     * Returns a hash of buffer names mapped to bind locations.
     * This is used to bind the correct buffer to the correct location in the shader.
     * @param geometry - The geometry where to get the buffer names
     * @param program - The program where to get the buffer names
     * @returns An object of buffer names mapped to the bind location.
```

Code after:
        const keyGen = [];
        let index = 0;
        // generate a key..

        const attributeKeys = Object.keys(program.attributeData).sort();

        for (let i = 0; i < attributeKeys.length; i++)
        {
            const attribute = program.attributeData[attributeKeys[i]];

            keyGen[index++] = attribute.location;
        }

        const stringKey = keyGen.join('|');

        program._attributeLocationsKey = createIdFromString(stringKey, 'programAttributes');

        return program._attributeLocationsKey;
    }

    /**
     * Returns a hash of buffer names mapped to bind locations.
     * This is used to bind the correct buffer to the correct location in the shader.
     * @param geometry - The geometry where to get the buffer names
     * @param program - The program where to get the buffer names
     * @returns An object of buffer names mapped to the bind location.
     */
    public getBufferNamesToBind(geometry: Geometry, program: GpuProgram): Record<string, string>
    {
        const key = (geometry._layoutKey << 16) | program._attributeLocationsKey;

        if (this._bindingNamesCache[key]) return this._bindingNamesCache[key];

        const data = this._createVertexBufferLayouts(geometry, program);

        // now map the data to the buffers..
        const bufferNamesToBind: Record<string, string> = Object.create(null);

        const attributeData = program.attributeData;

        for (let i = 0; i < data.length; i++)
        {
            for (const j in attributeData)
            {
                if (attributeData[j].location === i)
                {
                    bufferNamesToBind[i] = j;
                    break;
                }
            }
        }