/// <summary> /// /// </summary> /// <param name="device"></param> /// <param name="desc"></param> public ConstantBuffer(Direct3D10.Device device, Direct3D10.BufferDescription desc) { desc.SizeInBytes = Marshal.SizeOf(typeof(T)); if (device == null) { throw new ArgumentNullException("device"); } this.m_device = device; //_device.AddReference(); m_buffer = new Direct3D10.Buffer(device, desc); m_dataStream = new DataStream(desc.SizeInBytes, true, true); }
/// <summary> /// /// </summary> /// <param name="disposing"></param> private void Dispose(bool disposing) { if (m_device == null) { return; } if (disposing) { m_dataStream.Dispose(); } // NOTE: SharpDX 1.3 requires explicit Dispose() of all resource m_device.Dispose(); m_buffer.Dispose(); m_device = null; m_buffer = null; }