| 1976 | } // EffectInstance::tryConcatenateTransforms |
| 1977 | |
| 1978 | bool |
| 1979 | EffectInstance::allocateImagePlane(const ImageKey & key, |
| 1980 | const RectD & rod, |
| 1981 | const RectI & downscaleImageBounds, |
| 1982 | const RectI & fullScaleImageBounds, |
| 1983 | bool isProjectFormat, |
| 1984 | const ImagePlaneDesc & components, |
| 1985 | ImageBitDepthEnum depth, |
| 1986 | ImagePremultiplicationEnum premult, |
| 1987 | ImageFieldingOrderEnum fielding, |
| 1988 | double par, |
| 1989 | unsigned int mipmapLevel, |
| 1990 | bool renderFullScaleThenDownscale, |
| 1991 | StorageModeEnum storage, |
| 1992 | bool createInCache, |
| 1993 | ImagePtr* fullScaleImage, |
| 1994 | ImagePtr* downscaleImage) |
| 1995 | { |
| 1996 | //If we're rendering full scale and with input images at full scale, don't cache the downscale image since it is cheap to |
| 1997 | //recreate, instead cache the full-scale image |
| 1998 | if (renderFullScaleThenDownscale) { |
| 1999 | *downscaleImage = std::make_shared<Image>(components, rod, downscaleImageBounds, mipmapLevel, par, depth, premult, fielding, true); |
| 2000 | ImageParamsPtr upscaledImageParams = Image::makeParams(rod, |
| 2001 | fullScaleImageBounds, |
| 2002 | par, |
| 2003 | 0, |
| 2004 | isProjectFormat, |
| 2005 | components, |
| 2006 | depth, |
| 2007 | premult, |
| 2008 | fielding, |
| 2009 | storage, |
| 2010 | GL_TEXTURE_2D); |
| 2011 | //The upscaled image will be rendered with input images at full def, it is then the best possibly rendered image so cache it! |
| 2012 | |
| 2013 | fullScaleImage->reset(); |
| 2014 | getOrCreateFromCacheInternal(key, upscaledImageParams, createInCache, fullScaleImage); |
| 2015 | |
| 2016 | if (!*fullScaleImage) { |
| 2017 | return false; |
| 2018 | } |
| 2019 | } else { |
| 2020 | ///Cache the image with the requested components instead of the remapped ones |
| 2021 | ImageParamsPtr cachedImgParams = Image::makeParams(rod, |
| 2022 | downscaleImageBounds, |
| 2023 | par, |
| 2024 | mipmapLevel, |
| 2025 | isProjectFormat, |
| 2026 | components, |
| 2027 | depth, |
| 2028 | premult, |
| 2029 | fielding, |
| 2030 | storage, |
| 2031 | GL_TEXTURE_2D); |
| 2032 | |
| 2033 | //Take the lock after getting the image from the cache or while allocating it |
| 2034 | ///to make sure a thread will not attempt to write to the image while its being allocated. |
| 2035 | ///When calling allocateMemory() on the image, the cache already has the lock since it added it |
nothing calls this directly
no test coverage detected