license import { getGlslDifferences } from './glsl_version' ; import { GPGPUProgram } from './gpgpu_math' ; import { ENCODE_FLOAT_SNIPPET } from './shader_compiler_util' ; import { TextureUsage } from './tex_util' ; export class EncodeFloatProgram implements GPGPUProgram { variableNames = [ 'A' ] ; userCode : string ; outputShape : number [ ] ; outTexUsage = TextureUsage . DOWNLOAD ; constructor ( outputShape ) { const glsl = getGlslDifferences ( ) ; this . outputShape = outputShape ; this . userCode = `
      ${ ENCODE_FLOAT_SNIPPET }

      void main() {
        float x = getAAtOutCoords();
        ${ glsl . output } = encode_float(x);
      }
    ` ; } }