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

Method emitAndInstallGeoProc

src/gpu/ProgramBuilder.cpp:52–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52void ProgramBuilder::emitAndInstallGeoProc(std::string* outputColor, std::string* outputCoverage) {
53 // We don't want the RTAdjustName to be mangled, so we add it to the uniform handler before the
54 // processor guard.
55 uniformHandler()->addUniform(RTAdjustName, UniformFormat::Float4, ShaderStage::Vertex);
56 auto geometryProcessor = programInfo->getGeometryProcessor();
57 // Set the current processor so that all variable names will be mangled correctly.
58 ProcessorGuard processorGuard(this, geometryProcessor);
59 nameExpression(outputColor, "outputColor");
60 nameExpression(outputCoverage, "outputCoverage");
61
62 auto processorIndex = programInfo->getProcessorIndex(geometryProcessor);
63 // Enclose custom code in a block to avoid namespace conflicts
64 fragmentShaderBuilder()->codeAppendf("{ // Processor%d : %s\n", processorIndex,
65 geometryProcessor->name().c_str());
66 vertexShaderBuilder()->codeAppendf("// Processor%d : %s\n", processorIndex,
67 geometryProcessor->name().c_str());
68
69 GeometryProcessor::FPCoordTransformHandler transformHandler(programInfo, &transformedCoordVars);
70 GeometryProcessor::EmitArgs args(vertexShaderBuilder(), fragmentShaderBuilder(), varyingHandler(),
71 uniformHandler(), getContext()->caps()->shaderCaps(),
72 *outputColor, *outputCoverage, &transformHandler,
73 &subsetVarName);
74 geometryProcessor->emitCode(args);
75 fragmentShaderBuilder()->codeAppend("}");
76}
77
78void ProgramBuilder::emitAndInstallFragProcessors(std::string* color, std::string* coverage) {
79 size_t transformedCoordVarsIdx = 0;

Callers

nothing calls this directly

Calls 10

addUniformMethod · 0.80
getGeometryProcessorMethod · 0.80
getProcessorIndexMethod · 0.80
codeAppendfMethod · 0.80
c_strMethod · 0.80
shaderCapsMethod · 0.80
codeAppendMethod · 0.80
nameMethod · 0.45
capsMethod · 0.45
emitCodeMethod · 0.45

Tested by

no test coverage detected