diff --git a/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/TextureCache2D.cs b/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/TextureCache2D.cs index 1c0c2f8f3a3..1f75e99841b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/TextureCache2D.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/TextureCache2D.cs @@ -108,13 +108,10 @@ internal void ClearCache() var desc = m_Cache.descriptor; bool isMipped = desc.useMipMap; int mipCount = isMipped ? GetNumMips(desc.width, desc.height) : 1; - for (int depthSlice = 0; depthSlice < desc.volumeDepth; ++depthSlice) + for (int mipIdx = 0; mipIdx < mipCount; ++mipIdx) { - for (int mipIdx = 0; mipIdx < mipCount; ++mipIdx) - { - Graphics.SetRenderTarget(m_Cache, mipIdx, CubemapFace.Unknown, depthSlice); - GL.Clear(false, true, Color.clear); - } + Graphics.SetRenderTarget(m_Cache, mipIdx, CubemapFace.Unknown, -1); + GL.Clear(false, true, Color.clear); } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/TextureCacheCubemap.cs b/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/TextureCacheCubemap.cs index 219b153c098..c9b5fb056af 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/TextureCacheCubemap.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/TextureCacheCubemap.cs @@ -162,16 +162,10 @@ internal void ClearCache() var desc = m_Cache.descriptor; bool isMipped = desc.useMipMap; int mipCount = isMipped ? GetNumMips(desc.width, desc.height) : 1; - for (int depthSlice = 0; depthSlice < desc.volumeDepth; ++depthSlice) + for (int mipIdx = 0; mipIdx < mipCount; ++mipIdx) { - for (int mipIdx = 0; mipIdx < mipCount; ++mipIdx) - { - for (int faceIdx = 0; faceIdx < 6; ++faceIdx) - { - Graphics.SetRenderTarget(m_Cache, mipIdx, (CubemapFace)faceIdx, depthSlice); - GL.Clear(false, true, Color.clear); - } - } + Graphics.SetRenderTarget(m_Cache, mipIdx, CubemapFace.Unknown, -1); + GL.Clear(false, true, Color.clear); } }