Пример #1
0
cl_int CLFW::get(cl::Program::Sources &sources, std::vector<std::string> &files) {
  sources.clear();
  cl_int error = 0;
  if (files.size() == 0) return CL_INVALID_VALUE;
  for (int i = 0; i < files.size(); ++i) {
    Print("adding " + files[i] + " to sources.", infoFG, infoBG);
    long length = 0;
    char *source = 0;
    error|=loadFile(files[i].c_str(), &source, &length);
	sources.push_back({ source, length });
  }
  return error;
}
Пример #2
0
cl_int CLFW::get(cl::Program::Sources &sources) {
  sources.clear();
  char* text = 0;
  long temp;
  loadFile("./opencl_sources.txt", &text, &temp);
  char* file = strtok(text, "\n\r\n\0");
  do {
    Print("adding " + std::string(file) + " to sources.", infoFG, infoBG);
    long length = 0;
    char *source = 0;
    loadFile(file, &source, &length);
    sources.push_back({ source, length });
    file = strtok(NULL, "\n\r\n\0");
  } while (file != NULL);
  return CL_SUCCESS;
}