MCPcopy Create free account
hub / github.com/SFML/SFML / loadFromFile

Method loadFromFile

src/SFML/Graphics/Shader.cpp:345–363  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

343
344////////////////////////////////////////////////////////////
345bool Shader::loadFromFile(const std::filesystem::path& filename, Type type)
346{
347 // Read the file
348 std::vector<char> shader;
349 if (!getFileContents(filename, shader))
350 {
351 err() << "Failed to open shader file\n" << formatDebugPathInfo(filename) << std::endl;
352 return false;
353 }
354
355 // Compile the shader program
356 if (type == Type::Vertex)
357 return compile(shader.data(), {}, {});
358
359 if (type == Type::Geometry)
360 return compile({}, shader.data(), {});
361
362 return compile({}, {}, shader.data());
363}
364
365
366////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 2

getFileContentsFunction · 0.85
formatDebugPathInfoFunction · 0.85

Tested by

no test coverage detected