MCPcopy Create free account
hub / github.com/MrKepzie/Natron / getOrCreateMaskMixShader

Method getOrCreateMaskMixShader

Engine/OSGLContext.cpp:489–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

487}
488
489boost::shared_ptr<GLShader>
490OSGLContext::getOrCreateMaskMixShader(bool maskEnabled)
491{
492 int shader_i = maskEnabled ? 1 : 0;
493
494 if (_imp->applyMaskMixShader[shader_i]) {
495 return _imp->applyMaskMixShader[shader_i];
496 }
497 _imp->applyMaskMixShader[shader_i].reset( new GLShader() );
498
499 std::string fragmentSource;
500 if (maskEnabled) {
501 fragmentSource += "#define MASK_ENABLED\n";
502 }
503
504 fragmentSource += std::string(applyMaskMix_FragmentShader);
505
506#ifdef DEBUG
507 std::string error;
508 bool ok = _imp->applyMaskMixShader[shader_i]->addShader(GLShader::eShaderTypeFragment, fragmentSource.c_str(), &error);
509 if (!ok) {
510 qDebug() << error.c_str();
511 }
512#else
513 bool ok = _imp->applyMaskMixShader[shader_i]->addShader(GLShader::eShaderTypeFragment, fragmentSource.c_str(), 0);
514#endif
515 assert(ok);
516#ifdef DEBUG
517 ok = _imp->applyMaskMixShader[shader_i]->link(&error);
518 if (!ok) {
519 qDebug() << error.c_str();
520 }
521#else
522 ok = _imp->applyMaskMixShader[shader_i]->link();
523#endif
524 assert(ok);
525 Q_UNUSED(ok);
526
527 return _imp->applyMaskMixShader[shader_i];
528}
529
530boost::shared_ptr<GLShader>
531OSGLContext::getOrCreateCopyUnprocessedChannelsShader(bool doR,

Callers 1

applyMaskMixMethod · 0.80

Calls 3

addShaderMethod · 0.80
linkMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected