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

Method getOrCreateMaskMixShader

Engine/OSGLContext.cpp:507–546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505}
506
507GLShaderPtr
508OSGLContext::getOrCreateMaskMixShader(bool maskEnabled)
509{
510 int shader_i = maskEnabled ? 1 : 0;
511
512 if (_imp->applyMaskMixShader[shader_i]) {
513 return _imp->applyMaskMixShader[shader_i];
514 }
515 _imp->applyMaskMixShader[shader_i] = std::make_shared<GLShader>();
516
517 std::string fragmentSource;
518 if (maskEnabled) {
519 fragmentSource += "#define MASK_ENABLED\n";
520 }
521
522 fragmentSource += std::string(applyMaskMix_FragmentShader);
523
524#ifdef DEBUG
525 std::string error;
526 bool ok = _imp->applyMaskMixShader[shader_i]->addShader(GLShader::eShaderTypeFragment, fragmentSource.c_str(), &error);
527 if (!ok) {
528 qDebug() << error.c_str();
529 }
530#else
531 bool ok = _imp->applyMaskMixShader[shader_i]->addShader(GLShader::eShaderTypeFragment, fragmentSource.c_str(), nullptr);
532#endif
533 assert(ok);
534#ifdef DEBUG
535 ok = _imp->applyMaskMixShader[shader_i]->link(&error);
536 if (!ok) {
537 qDebug() << error.c_str();
538 }
539#else
540 ok = _imp->applyMaskMixShader[shader_i]->link();
541#endif
542 assert(ok);
543 Q_UNUSED(ok);
544
545 return _imp->applyMaskMixShader[shader_i];
546}
547
548GLShaderPtr
549OSGLContext::getOrCreateCopyUnprocessedChannelsShader(bool doR,

Callers 1

applyMaskMixMethod · 0.80

Calls 2

addShaderMethod · 0.80
linkMethod · 0.80

Tested by

no test coverage detected