// if (SystemInfo.SupportsTextureFormat(probeFormat) && !TextureCache.isMobileBuildTarget)
// // On editor the texture is uncompressed when operating against mobile build targets
////#if UNITY_2017_2_OR_NEWER
// if (SystemInfo.SupportsTextureFormat(probeFormat) && !UnityEngine.Rendering.GraphicsSettings.HasShaderDefine(UnityEngine.Rendering.BuiltinShaderDefine.UNITY_NO_DXT5nm))
//#endif
////#else
//// if (SystemInfo.SupportsTextureFormat(probeFormat) && !TextureCache.isMobileBuildTarget)
// For baked probes in the editor we need to factor in the actual hash of texture because we can't increment the update count of a texture that's baked on the disk.
// This code leaks logic from reflection probe baking into the texture cache which is not good... TODO: Find a way to do that outside of the texture cache.
// look for first non zero entry. Will by the least recently used entry
// since the array was pre-sorted (in linear time) in NewFrame()
{
idx=m_SortedIdxArray[j];
if(m_SliceArray[idx].countLRU==0)++j;// if entry already snagged by a new texture in this frame then ++j
elsebFound=true;
if(m_SliceArray[idx].countLRU==0)
++j;// if entry already snagged by a new texture in this frame then ++j
else
bFound=true;
needUpdate=true;
// if we are replacing an existing entry delete it from m_locatorInSliceArray.
if(m_SliceArray[idx].texId!=g_InvalidTexID)
{
m_SliceArray[idx].texId=texId;
sliceIndex=idx;
bFoundAvailOrExistingSlice=true;
bSwapSlice=true;
// wrap up
Debug.Assert(bFoundAvailOrExistingSlice,"The texture cache doesn't have enough space to store all textures. Please either increase the size of the texture cache, or use fewer unique textures.");
if(bFoundAvailOrExistingSlice)
if(sliceIndex!=-1)
m_SliceArray[sliceIndex].countLRU=0;// mark slice as in use this frame
m_SliceArray[sliceIndex].countLRU=0;// mark slice as in use this frame
}
if(bSwapSlice)// if this was a miss
{
m_SliceArray[sliceIndex].updateCount=updateCount;
returnsliceIndex;
}
// transfer new slice to sliceIndex from source texture
TransferToSlice(sliceIndex,texture);
}
// In case the texture content with which we update the cache is not the input texture, we need to provide the right update count.
Debug.Assert(sliceIndex!=-1,"The texture cache doesn't have enough space to store all textures. Please either increase the size of the texture cache, or use fewer unique textures.");
// Currently to know if you need shadow mask you need to go through all visible lights (of CullResult), check the LightBakingOutput struct and look at lightmapBakeType/mixedLightingMode. If one light have shadow mask bake mode, then you need shadow mask features (i.e extra Gbuffer).
// It mean that when we build a standalone player, if we detect a light with bake shadow mask, we generate all shader variant (with and without shadow mask) and at runtime, when a bake shadow mask light is visible, we dynamically allocate an extra GBuffer and switch the shader.
// So the first thing to do is to go through all the light: PrepareLightsForGPU
// -1 means that the texture is not ready yet (ie not convolved/compressed yet)
if(envIndex==-1)
returnfalse;
varenvLightData=newEnvLightData();
// CAUTION: localToWorld is the transform for the widget of the reflection probe. i.e the world position of the point use to do the cubemap capture (mean it include the local offset)
m_faceWorldToViewMatrixMatrices[i]=lookAt*Matrix4x4.Scale(newVector3(1.0f,1.0f,-1.0f));// Need to scale -1.0 on Z to match what is being done in the camera.wolrdToCameraMatrix API. ...
Debug.LogWarning("RenderCubemapGGXConvolution: Cubemap size is too small for GGX convolution, needs at least "+((int)EnvConstants.SpecCubeLodStep+1)+" mip levels");
return;
}
// Copy the first mip
using(newProfilingSample(cmd,"Copy Original Mip"))
Debug.LogWarning("RenderCubemapGGXConvolution: Cubemap size is too small for GGX convolution, needs at least "+((int)EnvConstants.SpecCubeLodStep+1)+" mip levels");
return;
}
if(!m_iblFilterGgx.IsInitialized())
m_iblFilterGgx.Initialize(cmd);
// Copy the first mip
using(newProfilingSample(cmd,"Copy Original Mip"))