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

Method onCreateProgram

test/src/CornerPinEffect.cpp:80–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80std::unique_ptr<RuntimeProgram> CornerPinEffect::onCreateProgram(Context* context) const {
81 auto gl = GLFunctions::Get(context);
82 // Clear the previously generated GLError, causing the subsequent CheckGLError to return an
83 // incorrect result.
84 ClearGLError(gl);
85 const auto caps = GLCaps::Get(context);
86 const auto isDesktop = caps->standard == GLStandard::GL;
87 auto filterProgram =
88 FilterProgram::Make(context, GetFinalShaderCode(CORNER_PIN_VERTEX_SHADER, isDesktop),
89 GetFinalShaderCode(CORNER_PIN_FRAGMENT_SHADER, isDesktop));
90 if (filterProgram == nullptr) {
91 return nullptr;
92 }
93
94 auto program = filterProgram->program;
95 auto uniforms = std::make_unique<CornerPinUniforms>();
96 uniforms->positionHandle = gl->getAttribLocation(program, "aPosition");
97 uniforms->textureCoordHandle = gl->getAttribLocation(program, "aTextureCoord");
98 filterProgram->uniforms = std::move(uniforms);
99 if (!CheckGLError(gl)) {
100 return nullptr;
101 }
102 return filterProgram;
103}
104
105bool CornerPinEffect::onDraw(const RuntimeProgram* program,
106 const std::vector<BackendTexture>& inputTextures,

Callers 1

executeMethod · 0.80

Calls 3

ClearGLErrorFunction · 0.85
MakeFunction · 0.85
GetFinalShaderCodeFunction · 0.85

Tested by

no test coverage detected