| 505 | } |
| 506 | |
| 507 | GLShaderPtr |
| 508 | OSGLContext::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 | |
| 548 | GLShaderPtr |
| 549 | OSGLContext::getOrCreateCopyUnprocessedChannelsShader(bool doR, |
no test coverage detected