// constructor for memory page with normal type public H1GpuMemoryAllocInfo(H1GpuMemoryPage newPage) { m_MemoryPageRef = newPage; // this constructor should trigger by normal type only if (m_MemoryPageRef.PageType != H1GpuMemoryPageType.Normal) { throw new InvalidOperationException("Invalid parameter for this constructor!"); } // set appropriate properties with memory chunk H1GpuMemoryChunk chunk = m_MemoryPageRef.Owner; SetProperties(chunk); }
// constructor for memory page with segmented type public H1GpuMemoryAllocInfo(H1GpuMemoryBlock newBlock) { m_MemoryBlockRef = newBlock; H1GpuMemoryPage page = m_MemoryBlockRef.MemoryPage; // this constructor should trigger by segmented type only if (page.PageType != H1GpuMemoryPageType.Segmented) { throw new InvalidOperationException("Invalid parameter for this constructor!"); } // set appropriate properties with memory chunk H1GpuMemoryChunk chunk = page.Owner; SetProperties(chunk); }