MCPcopy Create free account
hub / github.com/Tencent/tgfx / LoadGLShader

Function LoadGLShader

test/src/utils/TestUtils.cpp:36–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34static const std::string WEBP_FILE_EXT = ".webp";
35
36unsigned LoadGLShader(const GLFunctions* gl, unsigned shaderType, const std::string& source) {
37 auto shader = gl->createShader(shaderType);
38 const char* files[] = {source.c_str()};
39 gl->shaderSource(shader, 1, files, nullptr);
40 gl->compileShader(shader);
41 int success;
42 gl->getShaderiv(shader, GL_COMPILE_STATUS, &success);
43 if (!success) {
44 char infoLog[512];
45 gl->getShaderInfoLog(shader, 512, nullptr, infoLog);
46 LOGE("Could not compile shader:\n%s\ntype:%d info%s", source.c_str(), shaderType, infoLog);
47 gl->deleteShader(shader);
48 shader = 0;
49 }
50 return shader;
51}
52
53unsigned CreateGLProgram(Context* context, const std::string& vertex, const std::string& fragment) {
54 auto gl = GLFunctions::Get(context);

Callers 1

CreateGLProgramFunction · 0.85

Calls 1

c_strMethod · 0.80

Tested by

no test coverage detected