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

Method getImageFromCacheAndConvertIfNeeded

Engine/EffectInstance.cpp:1621–1866  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1619} // convertRAMImageToOpenGLTexture
1620
1621void
1622EffectInstance::getImageFromCacheAndConvertIfNeeded(bool /*useCache*/,
1623 StorageModeEnum storage,
1624 StorageModeEnum returnStorage,
1625 const ImageKey & key,
1626 unsigned int mipMapLevel,
1627 const RectI* boundsParam,
1628 const RectD* rodParam,
1629 const RectI& roi,
1630 ImageBitDepthEnum bitdepth,
1631 const ImagePlaneDesc & components,
1632 const EffectInstance::InputImagesMap & inputImages,
1633 const RenderStatsPtr & stats,
1634 const OSGLContextAttacherPtr& glContextAttacher,
1635 ImagePtr* image)
1636{
1637 ImageList cachedImages;
1638 bool isCached = false;
1639
1640 ///Find first something in the input images list
1641 if ( !inputImages.empty() ) {
1642 for (InputImagesMap::const_iterator it = inputImages.begin(); it != inputImages.end(); ++it) {
1643 for (ImageList::const_iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) {
1644 if ( !it2->get() ) {
1645 continue;
1646 }
1647 const ImageKey & imgKey = (*it2)->getKey();
1648 if (imgKey == key) {
1649 cachedImages.push_back(*it2);
1650 isCached = true;
1651 }
1652 }
1653 }
1654 }
1655
1656 if (!isCached) {
1657 // For textures, we lookup for a RAM image, if found we convert it to a texture
1658 if ( (storage == eStorageModeRAM) || (storage == eStorageModeGLTex) ) {
1659 isCached = appPTR->getImage(key, &cachedImages);
1660 } else if (storage == eStorageModeDisk) {
1661 isCached = appPTR->getImage_diskCache(key, &cachedImages);
1662 }
1663 }
1664
1665 if (stats && stats->isInDepthProfilingEnabled() && !isCached) {
1666 stats->addCacheInfosForNode(getNode(), true, false);
1667 }
1668
1669 if (isCached) {
1670 ///A ptr to a higher resolution of the image or an image with different comps/bitdepth
1671 ImagePtr imageToConvert;
1672
1673 for (ImageList::iterator it = cachedImages.begin(); it != cachedImages.end(); ++it) {
1674 unsigned int imgMMlevel = (*it)->getMipMapLevel();
1675 const ImagePlaneDesc & imgComps = (*it)->getComponents();
1676 ImageBitDepthEnum imgDepth = (*it)->getBitDepth();
1677
1678 if ( (*it)->getParams()->isRodProjectFormat() ) {

Callers 1

renderMaskFromStrokeMethod · 0.80

Calls 15

getAppFunction · 0.85
getSizeOfForBitDepthFunction · 0.85
emptyMethod · 0.80
getImage_diskCacheMethod · 0.80
addCacheInfosForNodeMethod · 0.80
getComponentsMethod · 0.80
isRodProjectFormatMethod · 0.80
getProjectMethod · 0.80
removeFromNodeCacheMethod · 0.80

Tested by

no test coverage detected