acquireProgram method

WebGLProgram? acquireProgram(
  1. WebGLParameters parameters,
  2. String cacheKey
)

Implementation

WebGLProgram? acquireProgram(WebGLParameters parameters, String cacheKey) {
  WebGLProgram? program;

  // Check if code has been already compiled
  for (int p = 0, pl = programs.length; p < pl; p++) {
    final preexistingProgram = programs[p];

    if (preexistingProgram.cacheKey == cacheKey) {
      program = preexistingProgram;
      ++program.usedTimes;

      break;
    }
  }

  if (program == null) {
    program = WebGLProgram(renderer, cacheKey, parameters, bindingStates);
    programs.add(program);
  }

  return program;
}