Exemplo n.º 1
0
        public SwapchainD3D12(
            D3D12GraphicsDevice device,
            SwapChainDescriptor descriptor,
            int backbufferCount)
            : base(device, descriptor, device.DXGIFactory, device.GraphicsQueue, backbufferCount, backbufferCount)
        {
            _backbufferTextures = new TextureD3D12[backbufferCount];
            for (int i = 0; i < backbufferCount; i++)
            {
                var backBufferTexture = _swapChain.GetBuffer <ID3D12Resource>(i);
                var d3dTextureDesc    = backBufferTexture.Description;
                var textureDescriptor = TextureDescriptor.Texture2D(
                    (int)d3dTextureDesc.Width,
                    d3dTextureDesc.Height,
                    d3dTextureDesc.MipLevels,
                    d3dTextureDesc.DepthOrArraySize,
                    d3dTextureDesc.Format.FromDirectXPixelFormat(),
                    D3D12Convert.Convert(d3dTextureDesc.Flags),
                    (SampleCount)d3dTextureDesc.SampleDescription.Count);

                _backbufferTextures[i] = new TextureD3D12(device, textureDescriptor, backBufferTexture);
            }

            // Configure base.
            Configure(descriptor);
        }
Exemplo n.º 2
0
        public CommandQueueD3D12(D3D12GraphicsDevice device, CommandQueueType queueType)
            : base(device, queueType)
        {
            switch (queueType)
            {
            case CommandQueueType.Graphics:
                CommandListType = CommandListType.Direct;
                break;

            case CommandQueueType.Compute:
                CommandListType = CommandListType.Compute;
                break;

            case CommandQueueType.Copy:
                CommandListType = CommandListType.Copy;
                break;

            default:
                CommandListType = CommandListType.Bundle;
                break;
            }

            D3D12CommandQueue      = device.D3D12Device.CreateCommandQueue(CommandListType);
            D3D12CommandQueue.Name = $"{CommandListType} Command Queue";
        }
 public DescriptorAllocator(D3D12GraphicsDevice device, DescriptorHeapType type)
 {
     Device          = device;
     Type            = type;
     IsShaderVisible =
         type == DescriptorHeapType.ConstantBufferViewShaderResourceViewUnorderedAccessView ||
         type == DescriptorHeapType.Sampler;
 }
Exemplo n.º 4
0
 public TextureD3D12(
     D3D12GraphicsDevice device,
     in TextureDescriptor descriptor,
Exemplo n.º 5
0
 public FenceD3D12(D3D12GraphicsDevice device, long initialValue)
 {
     Device      = device;
     _fence      = device.D3D12Device.CreateFence(initialValue, FenceFlags.None);
     _fenceEvent = new AutoResetEvent(false);
 }
Exemplo n.º 6
0
 public PipelineStateD3D12(D3D12GraphicsDevice device, in RenderPipelineDescriptor descriptor)
Exemplo n.º 7
0
 public BufferD3D12(D3D12GraphicsDevice device, in BufferDescriptor descriptor, IntPtr initialData)
Exemplo n.º 8
0
 public ShaderD3D12(D3D12GraphicsDevice device, in ShaderBytecode bytecode)