// Protected implementation of Dispose pattern. void Dispose(bool disposing) { if (m_Disposed) { return; } // As this is a struct, it could have been initialized using an empty constructor so we // need to make sure `cmd` isn't null to avoid a crash. Switching to a class would fix // this but will generate garbage on every frame (and this struct is used quite a lot). if (disposing) { m_Cmd?.EndSample(m_Name); m_Sampler?.End(); } m_Disposed = true; }
private void submitBuffer(CommandBuffer buffer) { buffer.EndSample(buffer.name); ExecuteBuffer(buffer); m_context.Submit(); }