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

Method getProgram

src/gpu/ProgramInfo.cpp:112–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112std::shared_ptr<Program> ProgramInfo::getProgram() const {
113 auto context = renderTarget->getContext();
114 BytesKey programKey = {};
115 geometryProcessor->computeProcessorKey(context, &programKey);
116 for (const auto& processor : fragmentProcessors) {
117 processor->computeProcessorKey(context, &programKey);
118 }
119 if (xferProcessor != nullptr) {
120 xferProcessor->computeProcessorKey(context, &programKey);
121 }
122 programKey.write(static_cast<uint32_t>(blendMode));
123 programKey.write(static_cast<uint32_t>(getOutputSwizzle().asKey()));
124 auto program = context->globalCache()->findProgram(programKey);
125 if (program == nullptr) {
126 program = ProgramBuilder::CreateProgram(context, this);
127 if (program == nullptr) {
128 LOGE("ProgramInfo::getProgram() Failed to create the program!");
129 return nullptr;
130 }
131 context->globalCache()->addProgram(programKey, program);
132 }
133 return program;
134}
135
136static AddressMode ToAddressMode(TileMode tileMode) {
137 switch (tileMode) {

Callers 2

executeMethod · 0.80
GetFlatTextureViewMethod · 0.80

Calls 7

asKeyMethod · 0.80
findProgramMethod · 0.80
globalCacheMethod · 0.80
addProgramMethod · 0.80
getContextMethod · 0.45
computeProcessorKeyMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected