浏览代码

fixed compute buffer leak

/main
vlad-andreev 8 年前
当前提交
63781976
共有 1 个文件被更改,包括 24 次插入7 次删除
  1. 31
      Assets/ScriptableRenderLoop/fptl/FptlLighting.cs

31
Assets/ScriptableRenderLoop/fptl/FptlLighting.cs


private TextureCache2D m_cookieTexArray;
private TextureCacheCubemap m_cubeCookieTexArray;
private TextureCacheCubemap m_cubeReflTexArray;
void OnEnable()
void OnEnable()
Rebuild();
}
Rebuild();
}
void OnValidate()
{

void ClearComputeBuffers()
{
if (m_aabbBoundsBuffer != null)
m_aabbBoundsBuffer.Release();
if (m_convexBoundsBuffer != null)
m_convexBoundsBuffer.Release();
if (m_lightDataBuffer != null)
m_lightDataBuffer.Release();
if (lightList != null)
lightList.Release();
}
kGBufferAlbedo = Shader.PropertyToID("_CameraGBufferTexture0");
ClearComputeBuffers();
kGBufferAlbedo = Shader.PropertyToID("_CameraGBufferTexture0");
kGBufferSpecRough = Shader.PropertyToID("_CameraGBufferTexture1");
kGBufferNormal = Shader.PropertyToID("_CameraGBufferTexture2");
kGBufferEmission = Shader.PropertyToID("_CameraGBufferTexture3");

void OnDisable()
{
// RenderLoop.renderLoopDelegate -= ExecuteRenderLoop;
if(m_DeferredMaterial) DestroyImmediate(m_DeferredMaterial);
// RenderLoop.renderLoopDelegate -= ExecuteRenderLoop;
if (m_DeferredMaterial) DestroyImmediate(m_DeferredMaterial);
if(m_DeferredReflectionMaterial) DestroyImmediate(m_DeferredReflectionMaterial);
m_cookieTexArray.Release();
m_cubeCookieTexArray.Release();

正在加载...
取消
保存