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

Method loadFromStream

src/SFML/Graphics/Shader.cpp:456–474  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

454
455////////////////////////////////////////////////////////////
456bool Shader::loadFromStream(InputStream& stream, Type type)
457{
458 // Read the shader code from the stream
459 std::vector<char> shader;
460 if (!getStreamContents(stream, shader))
461 {
462 err() << "Failed to read shader from stream" << std::endl;
463 return false;
464 }
465
466 // Compile the shader program
467 if (type == Type::Vertex)
468 return compile(shader.data(), {}, {});
469
470 if (type == Type::Geometry)
471 return compile({}, shader.data(), {});
472
473 return compile({}, {}, shader.data());
474}
475
476
477////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 1

getStreamContentsFunction · 0.85

Tested by

no test coverage detected