toVec() {
        const output = this.context.outputTextureLayout;
        const rank = output.shape.length;
        const strides = output.strides;
        const xScale = output.width;
        const yScale = output.height;
        const stridesBlock = [];
        for (let i = 0; i < rank - 1; ++i) {
            stridesBlock.push(`
        c[${i}] = offset / ${strides[i]};`);
            stridesBlock.push(`
        offset -= c[${i}] * ${strides[i]};`);
        }
        stridesBlock.push(`
        c[${rank - 1}] = offset;`);
        const body = `
      void toVec(vec2 texCoords, out int c[${rank}]) {
        int offset = coordsToOffset(texCoords, ${xScale}, ${yScale});
        ${stridesBlock.join('')}
      }
      void toVec(int offset, out int c[${rank}]) {
        ${stridesBlock.join('')}
      }
    `;
        return { toVec: new glsl_definitions_1.GlslLibRoutine(body, ['coordinates.coordsToOffset']) };
    }
/**
     * This is the main function to map from the given texture coordiantes (s,t)
     * to logical indices for the output
     * There will only be one single variation of this
     * Also see coordsToOffset and offsetToIndices for input-specific versions
     */
This is the main function to map from the given texture coordiantes (s,t)
to logical indices for the output
There will only be one single variation of this
Also see coordsToOffset and offsetToIndices for input-specific versions
This is the main function to map from the given texture coordiantes ( s t ) to logical indices for the output There will only be one single variation of this Also see coordsToOffset and offsetToIndices for input - specific versions
toVec() {
        const output = this.context.outputTextureLayout;
        const rank = output.shape.length;
        const strides = output.strides;
        const xScale = output.width;
        const yScale = output.height;
        const stridesBlock = [];
        for (let i = 0; i < rank - 1; ++i) {
            stridesBlock.push(`
        c[${i}] = offset / ${strides[i]};`);
            stridesBlock.push(`
        offset -= c[${i}] * ${strides[i]};`);
        }
        stridesBlock.push(`
        c[${rank - 1}] = offset;`);
        const body = `
      void toVec(vec2 texCoords, out int c[${rank}]) {
        int offset = coordsToOffset(texCoords, ${xScale}, ${yScale});
        ${stridesBlock.join('')}
      }
      void toVec(int offset, out int c[${rank}]) {
        ${stridesBlock.join('')}
      }
    `;
        return { toVec: new glsl_definitions_1.GlslLibRoutine(body, ['coordinates.coordsToOffset']) };
    }
toVec ( ) { const output = this . context . outputTextureLayout ; const rank = output . shape . length ; const strides = output . strides ; const xScale = output . width ; const yScale = output . height ; const stridesBlock = [ ] ; for ( let i = 0 ; i < rank - 1 ; ++ i ) { stridesBlock . push ( ` ${ i } ${ strides [ i ] } ` ) ; stridesBlock . push ( ` ${ i } ${ strides [ i ] } ` ) ; } stridesBlock . push ( ` ${ rank - 1 } ` ) ; const body = ` ${ rank } ${ xScale } ${ yScale } ${ stridesBlock . join ( '' ) } ${ rank } ${ stridesBlock . join ( '' ) } ` ; return { toVec : new glsl_definitions_1 . GlslLibRoutine ( body , [ 'coordinates.coordsToOffset' ] ) } ; }
This is the main function to map from the given texture coordiantes (s,t)
 to logical indices for the output
 There will only be one single variation of this
 Also see coordsToOffset and offsetToIndices for input-specific versions
This is the main function to map from the given texture coordiantes ( s t ) to logical indices for the output There will only be one single variation of this Also see coordsToOffset and offsetToIndices for input - specific versions