acquireProgram method

dynamic acquireProgram(
  1. WebGLParameters parameters,
  2. String cacheKey
)

Implementation

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

  // Check if code has been already compiled
  for (var p = 0, pl = programs.length; p < pl; p++) {
    var 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;
}