예제 #1
0
        internal D3D12GraphicsContext(D3D12GraphicsDevice graphicsDevice, int index)
            : base(graphicsDevice, index)
        {
            _graphicsFence = new D3D12GraphicsFence(graphicsDevice);
            _waitForExecuteCompletionGraphicsFence = new D3D12GraphicsFence(graphicsDevice);

            _d3d12CommandAllocator     = new ValueLazy <Pointer <ID3D12CommandAllocator> >(CreateD3D12CommandAllocator);
            _d3d12GraphicsCommandList  = new ValueLazy <Pointer <ID3D12GraphicsCommandList> >(CreateD3D12GraphicsCommandList);
            _d3d12RenderTargetView     = new ValueLazy <D3D12_CPU_DESCRIPTOR_HANDLE>(CreateD3D12RenderTargetDescriptor);
            _d3d12RenderTargetResource = new ValueLazy <Pointer <ID3D12Resource> >(CreateD3D12RenderTargetResource);

            _ = _state.Transition(to: Initialized);
        }
예제 #2
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;
예제 #3
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;