| 359 | } |
| 360 | |
| 361 | void GpuShaderCreator::finalize() |
| 362 | { |
| 363 | // For some GPU languages, the default header and footer do not fit well so, the class wrapper |
| 364 | // encapsulates differences when needed. |
| 365 | |
| 366 | const std::string originalHeader = getImpl()->m_parameterDeclarations + std::string("\n") + getImpl()->m_textureDeclarations; |
| 367 | getImpl()->m_classWrappingInterface->prepareClassWrapper(getResourcePrefix(), |
| 368 | getImpl()->m_functionName, |
| 369 | originalHeader); |
| 370 | |
| 371 | if (getImpl()->m_classWrappingInterface->hasClassWrapperHeader()) |
| 372 | { |
| 373 | getImpl()->m_parameterDeclarations |
| 374 | = getImpl()->m_classWrappingInterface->getClassWrapperHeader(originalHeader); |
| 375 | getImpl()->m_textureDeclarations.clear(); //clear texture declarations since they're already included in the header |
| 376 | } |
| 377 | getImpl()->m_functionFooter |
| 378 | = getImpl()->m_classWrappingInterface->getClassWrapperFooter(getImpl()->m_functionFooter); |
| 379 | |
| 380 | |
| 381 | // Build the complete shader program. |
| 382 | |
| 383 | createShaderText(getImpl()->m_parameterDeclarations.c_str(), |
| 384 | getImpl()->m_textureDeclarations.c_str(), |
| 385 | getImpl()->m_helperMethods.c_str(), |
| 386 | getImpl()->m_functionHeader.c_str(), |
| 387 | getImpl()->m_functionBody.c_str(), |
| 388 | getImpl()->m_functionFooter.c_str()); |
| 389 | |
| 390 | |
| 391 | if(IsDebugLoggingEnabled()) |
| 392 | { |
| 393 | std::ostringstream oss; |
| 394 | oss << std::endl |
| 395 | << "**" << std::endl |
| 396 | << "GPU Fragment Shader program" << std::endl |
| 397 | << getImpl()->m_shaderCode << std::endl; |
| 398 | |
| 399 | LogDebug(oss.str()); |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | |
| 404 |
nothing calls this directly
no test coverage detected