コード例 #1
0
 public void CopyTileMappings([NativeTypeName("ID3D12Resource *")] ID3D12Resource *pDstResource, [NativeTypeName("const D3D12_TILED_RESOURCE_COORDINATE *")] D3D12_TILED_RESOURCE_COORDINATE *pDstRegionStartCoordinate, [NativeTypeName("ID3D12Resource *")] ID3D12Resource *pSrcResource, [NativeTypeName("const D3D12_TILED_RESOURCE_COORDINATE *")] D3D12_TILED_RESOURCE_COORDINATE *pSrcRegionStartCoordinate, [NativeTypeName("const D3D12_TILE_REGION_SIZE *")] D3D12_TILE_REGION_SIZE *pRegionSize, D3D12_TILE_MAPPING_FLAGS Flags)
 {
     ((delegate * stdcall <ID3D12CommandQueue *, ID3D12Resource *, D3D12_TILED_RESOURCE_COORDINATE *, ID3D12Resource *, D3D12_TILED_RESOURCE_COORDINATE *, D3D12_TILE_REGION_SIZE *, D3D12_TILE_MAPPING_FLAGS, void>)(lpVtbl[9]))((ID3D12CommandQueue *)Unsafe.AsPointer(ref this), pDstResource, pDstRegionStartCoordinate, pSrcResource, pSrcRegionStartCoordinate, pRegionSize, Flags);
 }
コード例 #2
0
 public void ResolveQueryData([NativeTypeName("ID3D12QueryHeap *")] ID3D12QueryHeap *pQueryHeap, D3D12_QUERY_TYPE Type, [NativeTypeName("UINT")] uint StartIndex, [NativeTypeName("UINT")] uint NumQueries, [NativeTypeName("ID3D12Resource *")] ID3D12Resource *pDestinationBuffer, [NativeTypeName("UINT64")] ulong AlignedDestinationBufferOffset)
 {
     ((delegate * stdcall <ID3D12VideoEncodeCommandList *, ID3D12QueryHeap *, D3D12_QUERY_TYPE, uint, uint, ID3D12Resource *, ulong, void>)(lpVtbl[16]))((ID3D12VideoEncodeCommandList *)Unsafe.AsPointer(ref this), pQueryHeap, Type, StartIndex, NumQueries, pDestinationBuffer, AlignedDestinationBufferOffset);
 }
コード例 #3
0
 public void DiscardResource([NativeTypeName("ID3D12Resource *")] ID3D12Resource *pResource, [NativeTypeName("const D3D12_DISCARD_REGION *")] D3D12_DISCARD_REGION *pRegion)
 {
     ((delegate * stdcall <ID3D12VideoEncodeCommandList *, ID3D12Resource *, D3D12_DISCARD_REGION *, void>)(lpVtbl[13]))((ID3D12VideoEncodeCommandList *)Unsafe.AsPointer(ref this), pResource, pRegion);
 }
コード例 #4
0
 public void CreateUnorderedAccessView([NativeTypeName("ID3D12Resource *")] ID3D12Resource *pResource, [NativeTypeName("ID3D12Resource *")] ID3D12Resource *pCounterResource, [NativeTypeName("const D3D12_UNORDERED_ACCESS_VIEW_DESC *")] D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor)
 {
     ((delegate * unmanaged <ID3D12Device1 *, ID3D12Resource *, ID3D12Resource *, D3D12_UNORDERED_ACCESS_VIEW_DESC *, D3D12_CPU_DESCRIPTOR_HANDLE, void>)(lpVtbl[19]))((ID3D12Device1 *)Unsafe.AsPointer(ref this), pResource, pCounterResource, pDesc, DestDescriptor);
 }
コード例 #5
0
 public void CreateDepthStencilView([NativeTypeName("ID3D12Resource *")] ID3D12Resource *pResource, [NativeTypeName("const D3D12_DEPTH_STENCIL_VIEW_DESC *")] D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor)
 {
     ((delegate * unmanaged <ID3D12Device1 *, ID3D12Resource *, D3D12_DEPTH_STENCIL_VIEW_DESC *, D3D12_CPU_DESCRIPTOR_HANDLE, void>)(lpVtbl[21]))((ID3D12Device1 *)Unsafe.AsPointer(ref this), pResource, pDesc, DestDescriptor);
 }
コード例 #6
0
        protected override void Dispose(bool isDisposing)
        {
            var swapChain = _swapChain;

            if (swapChain != null)
            {
                _swapChain = null;
                _          = swapChain->Release();
            }

            var device = _device;

            if (device != null)
            {
                _device = null;
                _       = device->Release();
            }

            for (var index = 0; index < FrameCount; index++)
            {
                var renderTarget = _renderTargets[index];

                if (renderTarget != null)
                {
                    _renderTargets[index] = null;
                    _ = renderTarget->Release();
                }
            }

            var commandAllocator = _commandAllocator;

            if (commandAllocator != null)
            {
                _commandAllocator = null;
                _ = commandAllocator->Release();
            }

            var commandQueue = _commandQueue;

            if (commandQueue != null)
            {
                _commandQueue = null;
                _             = commandQueue->Release();
            }

            var rootSignature = _rootSignature;

            if (rootSignature != null)
            {
                _rootSignature = null;
                _ = rootSignature->Release();
            }

            var rtvHeap = _rtvHeap;

            if (rtvHeap != null)
            {
                _rtvHeap = null;
                _        = rtvHeap->Release();
            }

            var pipelineState = _pipelineState;

            if (pipelineState != null)
            {
                _pipelineState = null;
                _ = pipelineState->Release();
            }

            var commandList = _commandList;

            if (commandList != null)
            {
                _commandList = null;
                _            = commandList->Release();
            }

            var vertexBuffer = _vertexBuffer;

            if (vertexBuffer != null)
            {
                _vertexBuffer = null;
                _             = vertexBuffer->Release();
            }

            var fence = _fence;

            if (fence != null)
            {
                _fence = null;
                _      = fence->Release();
            }

            base.Dispose(isDisposing);
        }
コード例 #7
0
        /// <inheritdoc/>
        public override unsafe void OnUpdate(TimeSpan time)
        {
            if (this.isResizePending)
            {
                ApplyResize();

                this.isResizePending = false;
            }

            // Generate the new frame
            Gpu.Default.For(this.texture !.Width, this.texture.Height, this.shaderFactory(this.texture, time));

            using ComPtr <ID3D12Resource> d3D12Resource = default;

            // Get the underlying ID3D12Resource pointer for the texture
            _ = InteropServices.TryGetID3D12Resource(this.texture, FX.__uuidof <ID3D12Resource>(), (void **)d3D12Resource.GetAddressOf());

            // Get the target back buffer to update
            ID3D12Resource *d3D12ResourceBackBuffer = this.currentBufferIndex switch
            {
                0 => this.d3D12Resource0.Get(),
                1 => this.d3D12Resource1.Get(),
                _ => null
            };

            this.currentBufferIndex ^= 1;

            // Reset the command list and command allocator
            this.d3D12CommandAllocator.Get()->Reset();
            this.d3D12GraphicsCommandList.Get()->Reset(this.d3D12CommandAllocator.Get(), null);

            D3D12_RESOURCE_BARRIER *d3D12ResourceBarriers = stackalloc D3D12_RESOURCE_BARRIER[]
            {
                D3D12_RESOURCE_BARRIER.InitTransition(
                    d3D12Resource.Get(),
                    D3D12_RESOURCE_STATES.D3D12_RESOURCE_STATE_UNORDERED_ACCESS,
                    D3D12_RESOURCE_STATES.D3D12_RESOURCE_STATE_COPY_SOURCE),
                D3D12_RESOURCE_BARRIER.InitTransition(
                    d3D12ResourceBackBuffer,
                    D3D12_RESOURCE_STATES.D3D12_RESOURCE_STATE_COMMON,
                    D3D12_RESOURCE_STATES.D3D12_RESOURCE_STATE_COPY_DEST)
            };

            // Transition the resources to COPY_DEST and COPY_SOURCE respectively
            d3D12GraphicsCommandList.Get()->ResourceBarrier(2, d3D12ResourceBarriers);

            // Copy the generated frame to the target back buffer
            d3D12GraphicsCommandList.Get()->CopyResource(d3D12ResourceBackBuffer, d3D12Resource.Get());

            d3D12ResourceBarriers[0] = D3D12_RESOURCE_BARRIER.InitTransition(
                d3D12Resource.Get(),
                D3D12_RESOURCE_STATES.D3D12_RESOURCE_STATE_COPY_SOURCE,
                D3D12_RESOURCE_STATES.D3D12_RESOURCE_STATE_UNORDERED_ACCESS);

            d3D12ResourceBarriers[1] = D3D12_RESOURCE_BARRIER.InitTransition(
                d3D12ResourceBackBuffer,
                D3D12_RESOURCE_STATES.D3D12_RESOURCE_STATE_COPY_DEST,
                D3D12_RESOURCE_STATES.D3D12_RESOURCE_STATE_COMMON);

            // Transition the resources back to COMMON and UNORDERED_ACCESS respectively
            d3D12GraphicsCommandList.Get()->ResourceBarrier(2, d3D12ResourceBarriers);

            d3D12GraphicsCommandList.Get()->Close();

            // Execute the command list to perform the copy
            this.d3D12CommandQueue.Get()->ExecuteCommandLists(1, (ID3D12CommandList **)d3D12GraphicsCommandList.GetAddressOf());
            this.d3D12CommandQueue.Get()->Signal(this.d3D12Fence.Get(), this.nextD3D12FenceValue);

            // Present the new frame
            this.dxgiSwapChain1.Get()->Present(0, 0);

            if (this.nextD3D12FenceValue > this.d3D12Fence.Get()->GetCompletedValue())
            {
                this.d3D12Fence.Get()->SetEventOnCompletion(this.nextD3D12FenceValue, default);
            }

            this.nextD3D12FenceValue++;
        }
    }
}
コード例 #8
0
 public void CopyTiles(ID3D12Resource *pTiledResource, [NativeTypeName("const D3D12_TILED_RESOURCE_COORDINATE *")] D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, [NativeTypeName("const D3D12_TILE_REGION_SIZE *")] D3D12_TILE_REGION_SIZE *pTileRegionSize, ID3D12Resource *pBuffer, [NativeTypeName("UINT64")] ulong BufferStartOffsetInBytes, D3D12_TILE_COPY_FLAGS Flags)
 {
     ((delegate * unmanaged <ID3D12GraphicsCommandList6 *, ID3D12Resource *, D3D12_TILED_RESOURCE_COORDINATE *, D3D12_TILE_REGION_SIZE *, ID3D12Resource *, ulong, D3D12_TILE_COPY_FLAGS, void>)(lpVtbl[18]))((ID3D12GraphicsCommandList6 *)Unsafe.AsPointer(ref this), pTiledResource, pTileRegionStartCoordinate, pTileRegionSize, pBuffer, BufferStartOffsetInBytes, Flags);
 }
コード例 #9
0
 public void ResolveSubresource(ID3D12Resource *pDstResource, [NativeTypeName("UINT")] uint DstSubresource, ID3D12Resource *pSrcResource, [NativeTypeName("UINT")] uint SrcSubresource, DXGI_FORMAT Format)
 {
     ((delegate * unmanaged <ID3D12GraphicsCommandList6 *, ID3D12Resource *, uint, ID3D12Resource *, uint, DXGI_FORMAT, void>)(lpVtbl[19]))((ID3D12GraphicsCommandList6 *)Unsafe.AsPointer(ref this), pDstResource, DstSubresource, pSrcResource, SrcSubresource, Format);
 }
コード例 #10
0
 public void CopyBufferRegion(ID3D12Resource *pDstBuffer, [NativeTypeName("UINT64")] ulong DstOffset, ID3D12Resource *pSrcBuffer, [NativeTypeName("UINT64")] ulong SrcOffset, [NativeTypeName("UINT64")] ulong NumBytes)
 {
     ((delegate * unmanaged <ID3D12GraphicsCommandList6 *, ID3D12Resource *, ulong, ID3D12Resource *, ulong, ulong, void>)(lpVtbl[15]))((ID3D12GraphicsCommandList6 *)Unsafe.AsPointer(ref this), pDstBuffer, DstOffset, pSrcBuffer, SrcOffset, NumBytes);
 }
コード例 #11
0
 public void CopyResource(ID3D12Resource *pDstResource, ID3D12Resource *pSrcResource)
 {
     ((delegate * unmanaged <ID3D12GraphicsCommandList6 *, ID3D12Resource *, ID3D12Resource *, void>)(lpVtbl[17]))((ID3D12GraphicsCommandList6 *)Unsafe.AsPointer(ref this), pDstResource, pSrcResource);
 }
コード例 #12
0
 protected virtual void CreateBuffers()
 {
     _vertexBuffer = CreateVertexBuffer(out _vertexBufferView);
 }
コード例 #13
0
    public static ulong UpdateSubresources(ID3D12GraphicsCommandList *pCmdList, ID3D12Resource *pDestinationResource, ID3D12Resource *pIntermediate, uint FirstSubresource, uint NumSubresources, [NativeTypeName("UINT64")] ulong RequiredSize, [NativeTypeName("const D3D12_PLACED_SUBRESOURCE_FOOTPRINT *")] D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, [NativeTypeName("const UINT *")] uint *pNumRows, [NativeTypeName("const UINT64 *")] ulong *pRowSizesInBytes, [NativeTypeName("const D3D12_SUBRESOURCE_DATA *")] D3D12_SUBRESOURCE_DATA *pSrcData)
    {
        D3D12_RESOURCE_DESC IntermediateDesc = pIntermediate->GetDesc();

        D3D12_RESOURCE_DESC DestinationDesc = pDestinationResource->GetDesc();

        if (unchecked (IntermediateDesc.Dimension != D3D12_RESOURCE_DIMENSION_BUFFER || IntermediateDesc.Width < RequiredSize + pLayouts[0].Offset || RequiredSize > (nuint)(-1)) || (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER && (FirstSubresource != 0 || NumSubresources != 1)))
        {
            return(0);
        }

        byte *  pData;
        HRESULT hr = pIntermediate->Map(0, null, (void **)(&pData));

        if ((((HRESULT)(hr)) < 0))
        {
            return(0);
        }

        for (uint i = 0; i < NumSubresources; ++i)
        {
            if (pRowSizesInBytes[i] > unchecked ((nuint)(-1)))
            {
                return(0);
            }

            D3D12_MEMCPY_DEST DestData = new D3D12_MEMCPY_DEST
            {
                pData      = pData + pLayouts[i].Offset,
                RowPitch   = pLayouts[i].Footprint.RowPitch,
                SlicePitch = unchecked ((nuint)(pLayouts[i].Footprint.RowPitch) * (nuint)(pNumRows[i])),
            };

            MemcpySubresource(&DestData, &pSrcData[i], unchecked ((nuint)(pRowSizesInBytes[i])), pNumRows[i], pLayouts[i].Footprint.Depth);
        }

        pIntermediate->Unmap(0, null);
        if (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER)
        {
            pCmdList->CopyBufferRegion(pDestinationResource, 0, pIntermediate, pLayouts[0].Offset, pLayouts[0].Footprint.Width);
        }
        else
        {
            for (uint i = 0; i < NumSubresources; ++i)
            {
                D3D12_TEXTURE_COPY_LOCATION Dst = new D3D12_TEXTURE_COPY_LOCATION(pDestinationResource, i + FirstSubresource);
                D3D12_TEXTURE_COPY_LOCATION Src = new D3D12_TEXTURE_COPY_LOCATION(pIntermediate, pLayouts[i]);

                pCmdList->CopyTextureRegion(&Dst, 0, 0, 0, &Src, null);
            }
        }

        return(RequiredSize);
    }
コード例 #14
0
 public void SetThreadResourceCreationParams([NativeTypeName("ID3D12Resource *")] ID3D12Resource *pResource)
 {
     ((delegate * unmanaged <ID3D11On12On7 *, ID3D12Resource *, void>)(lpVtbl[4]))((ID3D11On12On7 *)Unsafe.AsPointer(ref this), pResource);
 }
コード例 #15
0
 public void RSSetShadingRateImage(ID3D12Resource *shadingRateImage)
 {
     ((delegate * unmanaged <ID3D12GraphicsCommandList6 *, ID3D12Resource *, void>)(lpVtbl[78]))((ID3D12GraphicsCommandList6 *)Unsafe.AsPointer(ref this), shadingRateImage);
 }
コード例 #16
0
 public void ClearUnorderedAccessViewFloat(D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, ID3D12Resource *pResource, [NativeTypeName("const FLOAT [4]")] float *Values, [NativeTypeName("UINT")] uint NumRects, [NativeTypeName("const D3D12_RECT *")] RECT *pRects)
 {
     ((delegate * unmanaged <ID3D12GraphicsCommandList6 *, D3D12_GPU_DESCRIPTOR_HANDLE, D3D12_CPU_DESCRIPTOR_HANDLE, ID3D12Resource *, float *, uint, RECT *, void>)(lpVtbl[50]))((ID3D12GraphicsCommandList6 *)Unsafe.AsPointer(ref this), ViewGPUHandleInCurrentHeap, ViewCPUHandle, pResource, Values, NumRects, pRects);
 }
コード例 #17
0
        // Load the rendering pipeline dependencies.
        private void LoadPipeline()
        {
            Guid             iid;
            ID3D12Debug *    debugController = null;
            IDXGIFactory4 *  factory         = null;
            IDXGIAdapter *   adapter         = null;
            IDXGISwapChain1 *swapChain       = null;

            try
            {
                var dxgiFactoryFlags = 0u;

#if DEBUG
                // Enable the debug layer (requires the Graphics Tools "optional feature").
                // NOTE: Enabling the debug layer after device creation will invalidate the active device.
                {
                    iid = IID_ID3D12Debug;
                    if (SUCCEEDED(D3D12GetDebugInterface(&iid, (void **)&debugController)))
                    {
                        debugController->EnableDebugLayer();

                        // Enable additional debug layers.
                        dxgiFactoryFlags |= DXGI_CREATE_FACTORY_DEBUG;
                    }
                }
#endif

                iid = IID_IDXGIFactory4;
                ThrowIfFailed(nameof(CreateDXGIFactory2), CreateDXGIFactory2(dxgiFactoryFlags, &iid, (void **)&factory));

                if (UseWarpDevice)
                {
                    iid = IID_IDXGIAdapter;
                    ThrowIfFailed(nameof(IDXGIFactory4.EnumWarpAdapter), factory->EnumWarpAdapter(&iid, (void **)&adapter));
                }
                else
                {
                    adapter = GetHardwareAdapter((IDXGIFactory1 *)factory);
                }

                fixed(ID3D12Device **device = &_device)
                {
                    iid = IID_ID3D12Device;
                    ThrowIfFailed(nameof(D3D12CreateDevice), D3D12CreateDevice((IUnknown *)adapter, D3D_FEATURE_LEVEL_11_0, &iid, (void **)device));
                }

                // Describe and create the command queue.
                var queueDesc = new D3D12_COMMAND_QUEUE_DESC();

                fixed(ID3D12CommandQueue **commandQueue = &_commandQueue)
                {
                    iid = IID_ID3D12CommandQueue;
                    ThrowIfFailed(nameof(ID3D12Device.CreateCommandQueue), _device->CreateCommandQueue(&queueDesc, &iid, (void **)commandQueue));
                }

                // Describe and create the swap chain.
                var swapChainDesc = new DXGI_SWAP_CHAIN_DESC1 {
                    BufferCount = FrameCount,
                    Width       = Width,
                    Height      = Height,
                    Format      = DXGI_FORMAT_B8G8R8A8_UNORM,
                    BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT,
                    SwapEffect  = DXGI_SWAP_EFFECT_FLIP_DISCARD,

                    // The swap chain could do multisampling for you in older versions of Direct3D
                    // You might see this in tutorials for D3D11
                    // This is no longer supported, so the swapchain has no multisampling itself
                    SampleDesc = new DXGI_SAMPLE_DESC(count: 1, quality: 0),
                };

                ThrowIfFailed(nameof(IDXGIFactory4.CreateSwapChainForHwnd), factory->CreateSwapChainForHwnd(
                                  (IUnknown *)_commandQueue, // Swap chain needs the queue so that it can force a flush on it.
                                  Win32Application.Hwnd,
                                  &swapChainDesc,
                                  pFullscreenDesc: null,
                                  pRestrictToOutput: null,
                                  &swapChain
                                  ));

                // This sample does not support fullscreen transitions.
                ThrowIfFailed(nameof(IDXGIFactory4.MakeWindowAssociation), factory->MakeWindowAssociation(Win32Application.Hwnd, DXGI_MWA_NO_ALT_ENTER));

                fixed(IDXGISwapChain3 **swapChain3 = &_swapChain)
                {
                    iid = IID_IDXGISwapChain3;
                    ThrowIfFailed(nameof(IDXGISwapChain1.QueryInterface), swapChain->QueryInterface(&iid, (void **)swapChain3));
                    _frameIndex = _swapChain->GetCurrentBackBufferIndex();
                }

                // Check MSAA support
                CheckMultiSamplingSupport();

                // Create descriptor heaps.
                {
                    // Describe and create a render target view (RTV) descriptor heap.
                    var rtvHeapDesc = new D3D12_DESCRIPTOR_HEAP_DESC {
                        NumDescriptors = 1, // We only have 1 render target
                        Type           = D3D12_DESCRIPTOR_HEAP_TYPE_RTV,
                    };

                    fixed(ID3D12DescriptorHeap **rtvHeap = &_rtvHeap)
                    {
                        iid = IID_ID3D12DescriptorHeap;
                        ThrowIfFailed(nameof(ID3D12Device.CreateDescriptorHeap), _device->CreateDescriptorHeap(&rtvHeapDesc, &iid, (void **)rtvHeap));
                    }

                    _rtvDescriptorSize = _device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
                }

                // Create the render target
                // We do not use the back buffer as that cannot be multisampled
                {
                    var desc = new D3D12_RESOURCE_DESC {
                        Height           = Height,
                        Width            = Width,
                        DepthOrArraySize = 1,
                        Alignment        = 0,
                        SampleDesc       = _msaaDesc,
                        Dimension        = D3D12_RESOURCE_DIMENSION_TEXTURE2D,
                        Flags            = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET,
                        Format           = DXGI_FORMAT_B8G8R8A8_UNORM,
                        Layout           = D3D12_TEXTURE_LAYOUT_UNKNOWN,
                        MipLevels        = 1
                    };

                    var heapProperties = new D3D12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT);

                    var clearColor = stackalloc float[4] {
                        0.0f, 0.2f, 0.4f, 1.0f
                    };
                    var clearVal = new D3D12_CLEAR_VALUE(DXGI_FORMAT_B8G8R8A8_UNORM, clearColor);

                    ID3D12Resource *multisampledRenderTarget;
                    iid = IID_ID3D12Resource;
                    ThrowIfFailed(nameof(ID3D12Device.CreateCommittedResource), _device->CreateCommittedResource(&heapProperties, D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_RENDER_TARGET, &clearVal, &iid, (void **)&multisampledRenderTarget));
                    _multiSampledRenderTarget = multisampledRenderTarget;
                }

                // Create the render target for the multisampled render target
                {
                    var rtvHandle = _rtvHeap->GetCPUDescriptorHandleForHeapStart();
                    _device->CreateRenderTargetView(_multiSampledRenderTarget, pDesc: null, rtvHandle);
                }

                // Create frame resources.
                {
                    iid = IID_ID3D12Resource;

                    for (var n = 0u; n < FrameCount; n++)
                    {
                        ID3D12Resource *renderTarget;
                        {
                            ThrowIfFailed(nameof(IDXGISwapChain3.GetBuffer), _swapChain->GetBuffer(n, &iid, (void **)&renderTarget));
                        }
                        _renderTargets[unchecked ((int)n)] = renderTarget;
                    }
                }

                fixed(ID3D12CommandAllocator **commandAllocator = &_commandAllocator)
                {
                    iid = IID_ID3D12CommandAllocator;
                    ThrowIfFailed(nameof(ID3D12Device.CreateRenderTargetView), _device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, &iid, (void **)commandAllocator));
                }
            }
            finally
            {
                if (debugController != null)
                {
                    debugController->Release();
                }

                if (factory != null)
                {
                    factory->Release();
                }

                if (adapter != null)
                {
                    adapter->Release();
                }

                if (swapChain != null)
                {
                    swapChain->Release();
                }
            }
        }
コード例 #18
0
 public void DiscardResource(ID3D12Resource *pResource, [NativeTypeName("const D3D12_DISCARD_REGION *")] D3D12_DISCARD_REGION *pRegion)
 {
     ((delegate * unmanaged <ID3D12GraphicsCommandList6 *, ID3D12Resource *, D3D12_DISCARD_REGION *, void>)(lpVtbl[51]))((ID3D12GraphicsCommandList6 *)Unsafe.AsPointer(ref this), pResource, pRegion);
 }
コード例 #19
0
 public int AssertResourceState(ID3D12Resource *pResource, [NativeTypeName("UINT")] uint Subresource, [NativeTypeName("UINT")] uint State)
 {
     return(((delegate * unmanaged <ID3D12DebugCommandList1 *, ID3D12Resource *, uint, uint, int>)(lpVtbl[3]))((ID3D12DebugCommandList1 *)Unsafe.AsPointer(ref this), pResource, Subresource, State));
 }
コード例 #20
0
 public void ResolveQueryData(ID3D12QueryHeap *pQueryHeap, D3D12_QUERY_TYPE Type, [NativeTypeName("UINT")] uint StartIndex, [NativeTypeName("UINT")] uint NumQueries, ID3D12Resource *pDestinationBuffer, [NativeTypeName("UINT64")] ulong AlignedDestinationBufferOffset)
 {
     ((delegate * unmanaged <ID3D12GraphicsCommandList6 *, ID3D12QueryHeap *, D3D12_QUERY_TYPE, uint, uint, ID3D12Resource *, ulong, void>)(lpVtbl[54]))((ID3D12GraphicsCommandList6 *)Unsafe.AsPointer(ref this), pQueryHeap, Type, StartIndex, NumQueries, pDestinationBuffer, AlignedDestinationBufferOffset);
 }
コード例 #21
0
 public void CreateShaderResourceView([NativeTypeName("ID3D12Resource *")] ID3D12Resource *pResource, [NativeTypeName("const D3D12_SHADER_RESOURCE_VIEW_DESC *")] D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor)
 {
     ((delegate * unmanaged <ID3D12Device1 *, ID3D12Resource *, D3D12_SHADER_RESOURCE_VIEW_DESC *, D3D12_CPU_DESCRIPTOR_HANDLE, void>)(lpVtbl[18]))((ID3D12Device1 *)Unsafe.AsPointer(ref this), pResource, pDesc, DestDescriptor);
 }
コード例 #22
0
 public void SetPredication(ID3D12Resource *pBuffer, [NativeTypeName("UINT64")] ulong AlignedBufferOffset, D3D12_PREDICATION_OP Operation)
 {
     ((delegate * unmanaged <ID3D12GraphicsCommandList6 *, ID3D12Resource *, ulong, D3D12_PREDICATION_OP, void>)(lpVtbl[55]))((ID3D12GraphicsCommandList6 *)Unsafe.AsPointer(ref this), pBuffer, AlignedBufferOffset, Operation);
 }
コード例 #23
0
 public void CreateRenderTargetView([NativeTypeName("ID3D12Resource *")] ID3D12Resource *pResource, [NativeTypeName("const D3D12_RENDER_TARGET_VIEW_DESC *")] D3D12_RENDER_TARGET_VIEW_DESC *pDesc, D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor)
 {
     ((delegate * unmanaged <ID3D12Device1 *, ID3D12Resource *, D3D12_RENDER_TARGET_VIEW_DESC *, D3D12_CPU_DESCRIPTOR_HANDLE, void>)(lpVtbl[20]))((ID3D12Device1 *)Unsafe.AsPointer(ref this), pResource, pDesc, DestDescriptor);
 }
コード例 #24
0
 public void ExecuteIndirect(ID3D12CommandSignature *pCommandSignature, [NativeTypeName("UINT")] uint MaxCommandCount, ID3D12Resource *pArgumentBuffer, [NativeTypeName("UINT64")] ulong ArgumentBufferOffset, ID3D12Resource *pCountBuffer, [NativeTypeName("UINT64")] ulong CountBufferOffset)
 {
     ((delegate * unmanaged <ID3D12GraphicsCommandList6 *, ID3D12CommandSignature *, uint, ID3D12Resource *, ulong, ID3D12Resource *, ulong, void>)(lpVtbl[59]))((ID3D12GraphicsCommandList6 *)Unsafe.AsPointer(ref this), pCommandSignature, MaxCommandCount, pArgumentBuffer, ArgumentBufferOffset, pCountBuffer, CountBufferOffset);
 }
コード例 #25
0
 public void GetResourceTiling([NativeTypeName("ID3D12Resource *")] ID3D12Resource *pTiledResource, [NativeTypeName("UINT *")] uint *pNumTilesForEntireResource, [NativeTypeName("D3D12_PACKED_MIP_INFO *")] D3D12_PACKED_MIP_INFO *pPackedMipDesc, [NativeTypeName("D3D12_TILE_SHAPE *")] D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, [NativeTypeName("UINT *")] uint *pNumSubresourceTilings, [NativeTypeName("UINT")] uint FirstSubresourceTilingToGet, [NativeTypeName("D3D12_SUBRESOURCE_TILING *")] D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips)
 {
     ((delegate * unmanaged <ID3D12Device1 *, ID3D12Resource *, uint *, D3D12_PACKED_MIP_INFO *, D3D12_TILE_SHAPE *, uint *, uint, D3D12_SUBRESOURCE_TILING *, void>)(lpVtbl[42]))((ID3D12Device1 *)Unsafe.AsPointer(ref this), pTiledResource, pNumTilesForEntireResource, pPackedMipDesc, pStandardTileShapeForNonPackedMips, pNumSubresourceTilings, FirstSubresourceTilingToGet, pSubresourceTilingsForNonPackedMips);
 }
コード例 #26
0
 public void AtomicCopyBufferUINT64(ID3D12Resource *pDstBuffer, [NativeTypeName("UINT64")] ulong DstOffset, ID3D12Resource *pSrcBuffer, [NativeTypeName("UINT64")] ulong SrcOffset, [NativeTypeName("UINT")] uint Dependencies, [NativeTypeName("ID3D12Resource *const *")] ID3D12Resource **ppDependentResources, [NativeTypeName("const D3D12_SUBRESOURCE_RANGE_UINT64 *")] D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges)
 {
     ((delegate * unmanaged <ID3D12GraphicsCommandList6 *, ID3D12Resource *, ulong, ID3D12Resource *, ulong, uint, ID3D12Resource **, D3D12_SUBRESOURCE_RANGE_UINT64 *, void>)(lpVtbl[61]))((ID3D12GraphicsCommandList6 *)Unsafe.AsPointer(ref this), pDstBuffer, DstOffset, pSrcBuffer, SrcOffset, Dependencies, ppDependentResources, pDependentSubresourceRanges);
 }
コード例 #27
0
 public void SetPredication([NativeTypeName("ID3D12Resource *")] ID3D12Resource *pBuffer, [NativeTypeName("UINT64")] ulong AlignedBufferOffset, D3D12_PREDICATION_OP Operation)
 {
     ((delegate * stdcall <ID3D12VideoEncodeCommandList *, ID3D12Resource *, ulong, D3D12_PREDICATION_OP, void>)(lpVtbl[17]))((ID3D12VideoEncodeCommandList *)Unsafe.AsPointer(ref this), pBuffer, AlignedBufferOffset, Operation);
 }
コード例 #28
0
 public void ResolveSubresourceRegion(ID3D12Resource *pDstResource, [NativeTypeName("UINT")] uint DstSubresource, [NativeTypeName("UINT")] uint DstX, [NativeTypeName("UINT")] uint DstY, ID3D12Resource *pSrcResource, [NativeTypeName("UINT")] uint SrcSubresource, [NativeTypeName("D3D12_RECT *")] RECT *pSrcRect, DXGI_FORMAT Format, D3D12_RESOLVE_MODE ResolveMode)
 {
     ((delegate * unmanaged <ID3D12GraphicsCommandList6 *, ID3D12Resource *, uint, uint, uint, ID3D12Resource *, uint, RECT *, DXGI_FORMAT, D3D12_RESOLVE_MODE, void>)(lpVtbl[64]))((ID3D12GraphicsCommandList6 *)Unsafe.AsPointer(ref this), pDstResource, DstSubresource, DstX, DstY, pSrcResource, SrcSubresource, pSrcRect, Format, ResolveMode);
 }
 public D3D12_TEXTURE_COPY_LOCATION(ID3D12Resource *pRes, [NativeTypeName("D3D12_PLACED_SUBRESOURCE_FOOTPRINT const &")] in D3D12_PLACED_SUBRESOURCE_FOOTPRINT Footprint)
コード例 #30
0
 public void UpdateTileMappings([NativeTypeName("ID3D12Resource *")] ID3D12Resource *pResource, [NativeTypeName("UINT")] uint NumResourceRegions, [NativeTypeName("const D3D12_TILED_RESOURCE_COORDINATE *")] D3D12_TILED_RESOURCE_COORDINATE *pResourceRegionStartCoordinates, [NativeTypeName("const D3D12_TILE_REGION_SIZE *")] D3D12_TILE_REGION_SIZE *pResourceRegionSizes, [NativeTypeName("ID3D12Heap *")] ID3D12Heap *pHeap, [NativeTypeName("UINT")] uint NumRanges, [NativeTypeName("const D3D12_TILE_RANGE_FLAGS *")] D3D12_TILE_RANGE_FLAGS *pRangeFlags, [NativeTypeName("const UINT *")] uint *pHeapRangeStartOffsets, [NativeTypeName("const UINT *")] uint *pRangeTileCounts, D3D12_TILE_MAPPING_FLAGS Flags)
 {
     ((delegate * stdcall <ID3D12CommandQueue *, ID3D12Resource *, uint, D3D12_TILED_RESOURCE_COORDINATE *, D3D12_TILE_REGION_SIZE *, ID3D12Heap *, uint, D3D12_TILE_RANGE_FLAGS *, uint *, uint *, D3D12_TILE_MAPPING_FLAGS, void>)(lpVtbl[8]))((ID3D12CommandQueue *)Unsafe.AsPointer(ref this), pResource, NumResourceRegions, pResourceRegionStartCoordinates, pResourceRegionSizes, pHeap, NumRanges, pRangeFlags, pHeapRangeStartOffsets, pRangeTileCounts, Flags);
 }