/// <summary> /// Creates a new <see cref="GraphicsDevice"/> instance for the input <see cref="ID3D12Device"/> /// </summary> /// <param name="device">The <see cref="ID3D12Device"/> to use for the new <see cref="GraphicsDevice"/> instance</param> /// <param name="description">The available info for the new <see cref="GraphicsDevice"/> instance</param> public GraphicsDevice(ID3D12Device device, AdapterDescription description) { NativeDevice = device; Description = description; WavefrontSize = 64; NativeComputeCommandQueue = NativeDevice.CreateCommandQueue(new CommandQueueDescription(CommandListType.Compute)); NativeCopyCommandQueue = NativeDevice.CreateCommandQueue(new CommandQueueDescription(CommandListType.Copy)); NativeDirectCommandQueue = NativeDevice.CreateCommandQueue(new CommandQueueDescription(CommandListType.Direct)); ComputeAllocatorPool = new CommandAllocatorPool(this, CommandListType.Compute); CopyAllocatorPool = new CommandAllocatorPool(this, CommandListType.Copy); DirectAllocatorPool = new CommandAllocatorPool(this, CommandListType.Direct); NativeComputeFence = NativeDevice.CreateFence(0); NativeCopyFence = NativeDevice.CreateFence(0); NativeDirectFence = NativeDevice.CreateFence(0); ShaderResourceViewAllocator = new DescriptorAllocator(this); }
/// <summary> /// Creates a new <see cref="GraphicsDevice"/> instance for the input <see cref="ID3D12Device"/> /// </summary> /// <param name="device">The <see cref="ID3D12Device"/> to use for the new <see cref="GraphicsDevice"/> instance</param> /// <param name="description">The available info for the new <see cref="GraphicsDevice"/> instance</param> public GraphicsDevice(ID3D12Device device, AdapterDescription description) { NativeDevice = device; Name = description.Description; MemorySize = description.DedicatedVideoMemory; ComputeUnits = device.Options1.TotalLaneCount; WavefrontSize = device.Options1.WaveLaneCountMin; NativeComputeCommandQueue = NativeDevice.CreateCommandQueue(new CommandQueueDescription(CommandListType.Compute)); NativeCopyCommandQueue = NativeDevice.CreateCommandQueue(new CommandQueueDescription(CommandListType.Copy)); NativeDirectCommandQueue = NativeDevice.CreateCommandQueue(new CommandQueueDescription(CommandListType.Direct)); ComputeAllocatorPool = new CommandAllocatorPool(this, CommandListType.Compute); CopyAllocatorPool = new CommandAllocatorPool(this, CommandListType.Copy); DirectAllocatorPool = new CommandAllocatorPool(this, CommandListType.Direct); NativeComputeFence = NativeDevice.CreateFence(0); NativeCopyFence = NativeDevice.CreateFence(0); NativeDirectFence = NativeDevice.CreateFence(0); ShaderResourceViewAllocator = new DescriptorAllocator(NativeDevice); }