Exemplo n.º 1
0
        internal D3D12GraphicsDevice(D3D12GraphicsAdapter graphicsAdapter, IGraphicsSurface graphicsSurface, int graphicsContextCount)
            : base(graphicsAdapter, graphicsSurface)
        {
            _idleGraphicsFence = new D3D12GraphicsFence(this);

            _d3d12CommandQueue = new ValueLazy <Pointer <ID3D12CommandQueue> >(CreateD3D12CommandQueue);
            _d3d12Device       = new ValueLazy <Pointer <ID3D12Device> >(CreateD3D12Device);
            _d3d12RenderTargetDescriptorHeap = new ValueLazy <Pointer <ID3D12DescriptorHeap> >(CreateD3D12RenderTargetDescriptorHeap);
            _dxgiSwapChain = new ValueLazy <Pointer <IDXGISwapChain3> >(CreateDxgiSwapChain);

            _graphicsContexts = CreateGraphicsContexts(this, graphicsContextCount);

            _ = _state.Transition(to: Initialized);

            WaitForIdleGraphicsFence.Reset();
            graphicsSurface.SizeChanged += OnGraphicsSurfaceSizeChanged;
Exemplo n.º 2
0
        internal D3D12GraphicsDevice(D3D12GraphicsAdapter adapter, IGraphicsSurface surface, int contextCount)
            : base(adapter, surface)
        {
            _idleFence = new D3D12GraphicsFence(this);

            _d3d12CommandQueue = new ValueLazy <Pointer <ID3D12CommandQueue> >(CreateD3D12CommandQueue);
            _d3d12Device       = new ValueLazy <Pointer <ID3D12Device> >(CreateD3D12Device);
            _d3d12Options      = new ValueLazy <D3D12_FEATURE_DATA_D3D12_OPTIONS>(GetD3D12Options);
            _d3d12RenderTargetDescriptorHeap   = new ValueLazy <Pointer <ID3D12DescriptorHeap> >(CreateD3D12RenderTargetDescriptorHeap);
            _d3d12ShaderResourceDescriptorHeap = new ValueLazy <Pointer <ID3D12DescriptorHeap> >(CreateD3D12ShaderResourceDescriptorHeap);
            _dxgiSwapChain   = new ValueLazy <Pointer <IDXGISwapChain3> >(CreateDxgiSwapChain);
            _memoryAllocator = new ValueLazy <D3D12GraphicsMemoryAllocator>(CreateMemoryAllocator);

            _contexts = CreateContexts(this, contextCount);

            _ = _state.Transition(to: Initialized);

            WaitForIdleGraphicsFence.Reset();
            surface.SizeChanged += OnGraphicsSurfaceSizeChanged;