public int FetchSlice(CommandBuffer cmd, Texture texture) { bool needUpdate; var sliceIndex = m_TextureCache.ReserveSlice(texture, out needUpdate); if (sliceIndex != -1) { if (needUpdate || m_ProbeBakingState[sliceIndex] != ProbeFilteringState.Ready) { using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.ConvolveReflectionProbe))) { // For now baking is done directly but will be time sliced in the future. Just preparing the code here. m_ProbeBakingState[sliceIndex] = ProbeFilteringState.Convolving; Texture[] result = ConvolveProbeTexture(cmd, texture); if (result == null) { return(-1); } if (m_PerformBC6HCompression) { cmd.BC6HEncodeFastCubemap( result[0], m_ProbeSize, m_TextureCache.GetTexCache(), 0, int.MaxValue, sliceIndex); m_TextureCache.SetSliceHash(sliceIndex, m_TextureCache.GetTextureHash(texture)); } else { m_TextureCache.UpdateSlice(cmd, sliceIndex, result, m_TextureCache.GetTextureHash(texture)); // Be careful to provide the update count from the input texture, not the temporary one used for convolving. } m_ProbeBakingState[sliceIndex] = ProbeFilteringState.Ready; } } } return(sliceIndex); }