MCPcopy Create free account
hub / github.com/AnswerDotAI/gpu.cpp / loadKernelCode

Function loadKernelCode

examples/shadertui/run.cpp:43–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43void loadKernelCode(const std::string &filename, std::string &codeString) {
44 codeString = "";
45 FILE *file = fopen(filename.c_str(), "r");
46 int nTries = 0;
47 while (!file) {
48 fclose(file);
49 std::this_thread::sleep_for(std::chrono::milliseconds(10));
50 file = fopen(filename.c_str(), "r");
51 if (++nTries > 5) {
52 LOG(kDefLog, kError, "Failed to open file: %s", filename.c_str());
53 return;
54 }
55 }
56 char buffer[4096];
57 while (fgets(buffer, sizeof(buffer), file)) {
58 codeString += buffer;
59 }
60 fclose(file);
61}
62
63int main() {
64

Callers 1

mainFunction · 0.85

Calls 1

LOGFunction · 0.85

Tested by

no test coverage detected