浏览代码

Improve memory management of the VBuffer

/Yibing-Project-2
Evgenii Golubev 7 年前
当前提交
00f52eb2
共有 1 个文件被更改,包括 16 次插入10 次删除
  1. 26
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/VolumetricLighting.cs

26
ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/VolumetricLighting.cs


void CreateVBuffer(int screenWidth, int screenHeight)
{
if (m_VBufferLighting != null)
{
if (m_VBufferLighting[0] != null) m_VBufferLighting[0].Release();
if (m_VBufferLighting[1] != null) m_VBufferLighting[1].Release();
}
else
{
m_VBufferLighting = new RenderTexture[2];
m_VBufferLightingRT = new RenderTargetIdentifier[2];
}
DestroyVBuffer();
m_VBufferLighting = new RenderTexture[2];
m_VBufferLightingRT = new RenderTargetIdentifier[2];
int w = 0, h = 0, d = 0;
ComputeVBufferResolutionAndScale(screenWidth, screenHeight, ref w, ref h, ref d);

m_VBufferLighting[i].Create();
m_VBufferLightingRT[i] = new RenderTargetIdentifier(m_VBufferLighting[i]);
}
}
void DestroyVBuffer()
{
if (m_VBufferLighting != null)
{
if (m_VBufferLighting[0] != null) m_VBufferLighting[0].Release();
if (m_VBufferLighting[1] != null) m_VBufferLighting[1].Release();
m_VBufferLighting = null;
m_VBufferLightingRT = null;
}
}

正在加载...
取消
保存