| 2920 | } // tiledRenderingFunctor |
| 2921 | |
| 2922 | ImagePtr |
| 2923 | EffectInstance::allocateImagePlaneAndSetInThreadLocalStorage(const ImagePlaneDesc & plane) |
| 2924 | { |
| 2925 | /* |
| 2926 | * The idea here is that we may have asked the plug-in to render say motion.forward, but it can only render both fotward |
| 2927 | * and backward at a time. |
| 2928 | * So it needs to allocate motion.backward and store it in the cache for efficiency. |
| 2929 | * Note that when calling this, the plug-in is already in the render action, hence in case of Host frame threading, |
| 2930 | * this function will be called as many times as there were thread used by the host frame threading. |
| 2931 | * For all other planes, there was a local temporary image, shared among all threads for the calls to render. |
| 2932 | * Since we may be in a thread of the host frame threading, only allocate a temporary image of the size of the rectangle |
| 2933 | * to render and mark that we're a plane allocated on the fly so that the tiledRenderingFunctor can know this is a plane |
| 2934 | * to handle specifically. |
| 2935 | */ |
| 2936 | EffectTLSDataPtr tls = _imp->tlsData->getTLSData(); |
| 2937 | |
| 2938 | if (!tls || !tls->currentRenderArgs.validArgs) { |
| 2939 | return ImagePtr(); |
| 2940 | } |
| 2941 | |
| 2942 | assert( !tls->currentRenderArgs.outputPlanes.empty() ); |
| 2943 | |
| 2944 | const EffectInstance::PlaneToRender & firstPlane = tls->currentRenderArgs.outputPlanes.begin()->second; |
| 2945 | bool useCache = firstPlane.fullscaleImage->usesBitMap() || firstPlane.downscaleImage->usesBitMap(); |
| 2946 | if ( getNode()->getPluginID().rfind("uk.co.thefoundry.furnace", 0) != std::string::npos ) { |
| 2947 | //Furnace plug-ins are bugged and do not render properly both planes, just wipe the image. |
| 2948 | useCache = false; |
| 2949 | } |
| 2950 | const ImagePtr & img = firstPlane.fullscaleImage->usesBitMap() ? firstPlane.fullscaleImage : firstPlane.downscaleImage; |
| 2951 | ImageParamsPtr params = img->getParams(); |
| 2952 | EffectInstance::PlaneToRender p; |
| 2953 | bool ok = allocateImagePlane(img->getKey(), |
| 2954 | tls->currentRenderArgs.rod, |
| 2955 | tls->currentRenderArgs.renderWindowPixel, |
| 2956 | tls->currentRenderArgs.renderWindowPixel, |
| 2957 | false /*isProjectFormat*/, |
| 2958 | plane, |
| 2959 | img->getBitDepth(), |
| 2960 | img->getPremultiplication(), |
| 2961 | img->getFieldingOrder(), |
| 2962 | img->getPixelAspectRatio(), |
| 2963 | img->getMipMapLevel(), |
| 2964 | false, |
| 2965 | img->getParams()->getStorageInfo().mode, |
| 2966 | useCache, |
| 2967 | &p.fullscaleImage, |
| 2968 | &p.downscaleImage); |
| 2969 | if (!ok) { |
| 2970 | return ImagePtr(); |
| 2971 | } else { |
| 2972 | p.renderMappedImage = p.downscaleImage; |
| 2973 | p.isAllocatedOnTheFly = true; |
| 2974 | |
| 2975 | /* |
| 2976 | * Allocate a temporary image for rendering only if using cache |
| 2977 | */ |
| 2978 | if (useCache) { |
| 2979 | #ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES |
no test coverage detected