コード例 #1
0
        internal D3D12GraphicsBuffer(D3D12GraphicsDevice graphicsDevice, GraphicsBufferKind kind, ulong size, ulong stride)
            : base(graphicsDevice, kind, size, stride)
        {
            _d3d12Resource = new ValueLazy <Pointer <ID3D12Resource> >(CreateD3D12Resource);

            _ = _state.Transition(to: Initialized);
        }
コード例 #2
0
        internal D3D12GraphicsPipeline(D3D12GraphicsDevice graphicsDevice, D3D12GraphicsPipelineSignature signature, D3D12GraphicsShader?vertexShader, D3D12GraphicsShader?pixelShader)
            : base(graphicsDevice, signature, vertexShader, pixelShader)
        {
            _d3d12PipelineState = new ValueLazy <Pointer <ID3D12PipelineState> >(CreateD3D12GraphicsPipelineState);

            _ = _state.Transition(to: Initialized);
        }
コード例 #3
0
        internal D3D12GraphicsPipelineSignature(D3D12GraphicsDevice device, ReadOnlySpan <GraphicsPipelineInput> inputs, ReadOnlySpan <GraphicsPipelineResource> resources)
            : base(device, inputs, resources)
        {
            _d3d12RootSignature = new ValueLazy <Pointer <ID3D12RootSignature> >(CreateD3D12RootSignature);

            _ = _state.Transition(to: Initialized);
        }
コード例 #4
0
        internal D3D12GraphicsFence(D3D12GraphicsDevice graphicsDevice)
            : base(graphicsDevice)
        {
            _d3d12Fence            = new ValueLazy <Pointer <ID3D12Fence> >(CreateD3D12Fence);
            _d3d12FenceSignalEvent = new ValueLazy <HANDLE>(CreateEventHandle);

            _ = _state.Transition(to: Initialized);
        }
コード例 #5
0
            static D3D12GraphicsContext[] CreateContexts(D3D12GraphicsDevice device, int contextCount)
            {
                var contexts = new D3D12GraphicsContext[contextCount];

                for (var index = 0; index < contexts.Length; index++)
                {
                    contexts[index] = new D3D12GraphicsContext(device, index);
                }

                return(contexts);
            }
コード例 #6
0
ファイル: D3D12GraphicsDevice.cs プロジェクト: ewin66/terrafx
            static D3D12GraphicsContext[] CreateGraphicsContexts(D3D12GraphicsDevice graphicsDevice, int graphicsContextCount)
            {
                var graphicsContexts = new D3D12GraphicsContext[graphicsContextCount];

                for (var index = 0; index < graphicsContexts.Length; index++)
                {
                    graphicsContexts[index] = new D3D12GraphicsContext(graphicsDevice, index);
                }

                return(graphicsContexts);
            }
コード例 #7
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);
        }
コード例 #8
0
        internal D3D12GraphicsShader(D3D12GraphicsDevice device, GraphicsShaderKind kind, ReadOnlySpan <byte> bytecode, string entryPointName)
            : base(device, kind, entryPointName)
        {
            var bytecodeLength = (nuint)bytecode.Length;

            _d3d12ShaderBytecode.pShaderBytecode = Allocate(bytecodeLength);
            _d3d12ShaderBytecode.BytecodeLength  = bytecodeLength;

            var destination = new Span <byte>(_d3d12ShaderBytecode.pShaderBytecode, (int)bytecodeLength);

            bytecode.CopyTo(destination);

            _ = _state.Transition(to: Initialized);
        }
コード例 #9
0
        internal D3D12GraphicsMemoryAllocator(D3D12GraphicsDevice device, ulong blockPreferredSize)
            : base(device, blockPreferredSize)
        {
            blockPreferredSize = BlockPreferredSize;

            var supportsResourceHeapTier2 = Device.D3D12Options.ResourceHeapTier >= D3D12_RESOURCE_HEAP_TIER_2;
            var blockMinimumSize          = blockPreferredSize >> 3;

            if (blockMinimumSize == 0)
            {
                blockMinimumSize = blockPreferredSize;
            }

            if (supportsResourceHeapTier2)
            {
                _blockCollections = new D3D12GraphicsMemoryBlockCollection[3] {
                    new D3D12GraphicsMemoryBlockCollection(blockMinimumSize, blockPreferredSize, BlockMarginSize, BlockMinimumFreeRegionSizeToRegister, this, minimumBlockCount: 0, maximumBlockCount: nuint.MaxValue, D3D12_HEAP_FLAG_NONE, D3D12_HEAP_TYPE_DEFAULT),
                    new D3D12GraphicsMemoryBlockCollection(blockMinimumSize, blockPreferredSize, BlockMarginSize, BlockMinimumFreeRegionSizeToRegister, this, minimumBlockCount: 0, maximumBlockCount: nuint.MaxValue, D3D12_HEAP_FLAG_NONE, D3D12_HEAP_TYPE_UPLOAD),
                    new D3D12GraphicsMemoryBlockCollection(blockMinimumSize, blockPreferredSize, BlockMarginSize, BlockMinimumFreeRegionSizeToRegister, this, minimumBlockCount: 0, maximumBlockCount: nuint.MaxValue, D3D12_HEAP_FLAG_NONE, D3D12_HEAP_TYPE_READBACK),
                };
            }
            else
            {
                _blockCollections = new D3D12GraphicsMemoryBlockCollection[9] {
                    new D3D12GraphicsMemoryBlockCollection(blockMinimumSize, blockPreferredSize, BlockMarginSize, BlockMinimumFreeRegionSizeToRegister, this, minimumBlockCount: 0, maximumBlockCount: nuint.MaxValue, D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES | D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES, D3D12_HEAP_TYPE_DEFAULT),
                    new D3D12GraphicsMemoryBlockCollection(blockMinimumSize, blockPreferredSize, BlockMarginSize, BlockMinimumFreeRegionSizeToRegister, this, minimumBlockCount: 0, maximumBlockCount: nuint.MaxValue, D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES, D3D12_HEAP_TYPE_DEFAULT),
                    new D3D12GraphicsMemoryBlockCollection(blockMinimumSize, blockPreferredSize, BlockMarginSize, BlockMinimumFreeRegionSizeToRegister, this, minimumBlockCount: 0, maximumBlockCount: nuint.MaxValue, D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES, D3D12_HEAP_TYPE_DEFAULT),
                    new D3D12GraphicsMemoryBlockCollection(blockMinimumSize, blockPreferredSize, BlockMarginSize, BlockMinimumFreeRegionSizeToRegister, this, minimumBlockCount: 0, maximumBlockCount: nuint.MaxValue, D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES | D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES, D3D12_HEAP_TYPE_UPLOAD),
                    new D3D12GraphicsMemoryBlockCollection(blockMinimumSize, blockPreferredSize, BlockMarginSize, BlockMinimumFreeRegionSizeToRegister, this, minimumBlockCount: 0, maximumBlockCount: nuint.MaxValue, D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES, D3D12_HEAP_TYPE_UPLOAD),
                    new D3D12GraphicsMemoryBlockCollection(blockMinimumSize, blockPreferredSize, BlockMarginSize, BlockMinimumFreeRegionSizeToRegister, this, minimumBlockCount: 0, maximumBlockCount: nuint.MaxValue, D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES, D3D12_HEAP_TYPE_UPLOAD),
                    new D3D12GraphicsMemoryBlockCollection(blockMinimumSize, blockPreferredSize, BlockMarginSize, BlockMinimumFreeRegionSizeToRegister, this, minimumBlockCount: 0, maximumBlockCount: nuint.MaxValue, D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES | D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES, D3D12_HEAP_TYPE_READBACK),
                    new D3D12GraphicsMemoryBlockCollection(blockMinimumSize, blockPreferredSize, BlockMarginSize, BlockMinimumFreeRegionSizeToRegister, this, minimumBlockCount: 0, maximumBlockCount: nuint.MaxValue, D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES, D3D12_HEAP_TYPE_READBACK),
                    new D3D12GraphicsMemoryBlockCollection(blockMinimumSize, blockPreferredSize, BlockMarginSize, BlockMinimumFreeRegionSizeToRegister, this, minimumBlockCount: 0, maximumBlockCount: nuint.MaxValue, D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES, D3D12_HEAP_TYPE_READBACK),
                };
            }

            _supportsResourceHeapTier2 = supportsResourceHeapTier2;

            // TODO: UpdateBudget
            _ = _state.Transition(to: Initialized);
        }
コード例 #10
0
 internal D3D12GraphicsPrimitive(D3D12GraphicsDevice graphicsDevice, D3D12GraphicsPipeline graphicsPipeline, D3D12GraphicsBuffer vertexBuffer, D3D12GraphicsBuffer?indexBuffer, ReadOnlySpan <GraphicsBuffer> constantBuffers)
     : base(graphicsDevice, graphicsPipeline, vertexBuffer, indexBuffer, constantBuffers)
 {
     _ = _state.Transition(to: Initialized);
 }
コード例 #11
0
 internal D3D12GraphicsPrimitive(D3D12GraphicsDevice device, D3D12GraphicsPipeline pipeline, in GraphicsBufferView vertexBufferView, in GraphicsBufferView indexBufferView, ReadOnlySpan <GraphicsResource> inputResources)
コード例 #12
0
ファイル: D3D12GraphicsHeap.cs プロジェクト: ewin66/terrafx
 internal D3D12GraphicsHeap(D3D12GraphicsDevice graphicsDevice, ulong size, GraphicsHeapCpuAccess cpuAccess)
     : base(graphicsDevice, size, cpuAccess)
 {
     _d3d12Heap = new ValueLazy <Pointer <ID3D12Heap> >(CreateD3D12Heap);
 }