MCPcopy Create free account
hub / github.com/axmolengine/axmol / ProgramGL

Method ProgramGL

core/renderer/backend/opengl/ProgramGL.cpp:121–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119#endif
120
121ProgramGL::ProgramGL(std::string_view vertexShader, std::string_view fragmentShader)
122 : Program(vertexShader, fragmentShader)
123{
124 _vertexShaderModule = static_cast<ShaderModuleGL*>(ShaderCache::getInstance()->newVertexShaderModule(_vertexShader));
125 _fragmentShaderModule = static_cast<ShaderModuleGL*>(ShaderCache::getInstance()->newFragmentShaderModule(_fragmentShader));
126
127 AX_SAFE_RETAIN(_vertexShaderModule);
128 AX_SAFE_RETAIN(_fragmentShaderModule);
129 compileProgram();
130 computeUniformInfos();
131#if AX_ENABLE_CACHE_TEXTURE_DATA
132 for (const auto& uniform : _activeUniformInfos)
133 {
134 auto location = uniform.second.location;
135 _originalUniformLocations[uniform.first] = location;
136 _mapToCurrentActiveLocation[location] = location;
137 _mapToOriginalLocation[location] = location;
138 }
139
140 _backToForegroundListener =
141 EventListenerCustom::create(EVENT_RENDERER_RECREATED, [this](EventCustom*) { this->reloadProgram(); });
142 Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundListener, -1);
143#endif
144
145 setBuiltinLocations();
146}
147
148ProgramGL::~ProgramGL()
149{

Callers

nothing calls this directly

Calls 6

reloadProgramMethod · 0.95
getInstanceFunction · 0.85
createFunction · 0.85
newVertexShaderModuleMethod · 0.80

Tested by

no test coverage detected