コード例 #1
0
 public unsafe void UpdateTileMappings(
     ID3D12Resource resource,
     TiledResourceCoordinate[] resourceRegionStartCoordinates,
     TileRegionSize[] resourceRegionSizes,
     ID3D12Heap heap,
     TileRangeFlags[] rangeFlags,
     int[] heapRangeStartOffsets,
     int[] rangeTileCounts,
     TileMappingFlags flags = TileMappingFlags.None)
 {
     fixed(TiledResourceCoordinate *pResourceRegionStartCoordinates = resourceRegionStartCoordinates)
     fixed(TileRegionSize * pResourceRegionSizes = resourceRegionSizes)
     fixed(TileRangeFlags * pRangeFlags          = rangeFlags)
     fixed(int *pHeapRangeStartOffsets           = heapRangeStartOffsets)
     fixed(int *pRangeTileCounts = rangeTileCounts)
     UpdateTileMappings(resource,
                        resourceRegionStartCoordinates.Length,
                        pResourceRegionStartCoordinates,
                        pResourceRegionSizes,
                        heap,
                        rangeFlags.Length,
                        pRangeFlags,
                        pHeapRangeStartOffsets,
                        pRangeTileCounts,
                        flags);
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ResourceTransitionBarrier"/> struct.
 /// </summary>
 /// <param name="resource">The <see cref="ID3D12Resource"/>.</param>
 /// <param name="stateBefore">The state before.</param>
 /// <param name="stateAfter">The state after.</param>
 /// <param name="subresource">The subresource.</param>
 /// <exception cref="System.ArgumentNullException">resource</exception>
 public ResourceTransitionBarrier(ID3D12Resource resource, ResourceStates stateBefore, ResourceStates stateAfter, int subresource = -1)
 {
     ResourcePointer = resource.NativePointer;
     Subresource     = subresource;
     StateBefore     = stateBefore;
     StateAfter      = stateAfter;
     Subresource     = subresource;
 }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ResourceAliasingBarrier"/> struct.
        /// </summary>
        /// <param name="resourceBefore">The resource before.</param>
        /// <param name="resourceAfter">The resource after.</param>
        /// <exception cref="System.ArgumentNullException">resourceBefore</exception>
        public ResourceAliasingBarrier(ID3D12Resource resourceBefore, ID3D12Resource resourceAfter)
        {
            Guard.NotNull(resourceBefore, nameof(resourceBefore));
            Guard.NotNull(resourceAfter, nameof(resourceAfter));

            ResourceBeforePointer = resourceBefore.NativePointer;
            ResourceAfterPointer  = resourceAfter.NativePointer;
        }
コード例 #4
0
        public unsafe void ResourceBarrierUnorderedAccessView(ID3D12Resource resource)
        {
            var barrier = new ResourceBarrier
            {
                Type = ResourceBarrierType.UnorderedAccessView,
                UnorderedAccessView = new ResourceUnorderedAccessViewBarrier(resource)
            };

            ResourceBarrier(1, new IntPtr(&barrier));
        }
コード例 #5
0
        public unsafe void ResourceBarrierAliasing(ID3D12Resource resourceBefore, ID3D12Resource resourceAfter)
        {
            var barrier = new ResourceBarrier
            {
                Type     = ResourceBarrierType.Aliasing,
                Aliasing = new ResourceAliasingBarrier(resourceBefore, resourceAfter)
            };

            ResourceBarrier(1, new IntPtr(&barrier));
        }
コード例 #6
0
        public void ResourceBarrierTransition(
            ID3D12Resource resource,
            ResourceStates stateBefore,
            ResourceStates stateAfter,
            int subresource            = D3D12.ResourceBarrierAllSubResources,
            ResourceBarrierFlags flags = ResourceBarrierFlags.None)
        {
            var barrier = new ResourceBarrier(
                new ResourceTransitionBarrier(resource, stateBefore, stateAfter, subresource),
                flags);

            ResourceBarrier(1, &barrier);
        }
コード例 #7
0
 /// <summary>
 /// Copy a region of a multisampled or compressed resource into a non-multisampled or non-compressed resource.
 /// </summary>
 /// <param name="dstResource">Destination resource.</param>
 /// <param name="dstSubresource">A zero-based index that identifies the destination subresource. Use <see cref="ID3D12Resource.CalculateSubResourceIndex(int, int, int, int, int)"/> to calculate the subresource index if the parent resource is complex.</param>
 /// <param name="dstX">The X coordinate of the left-most edge of the destination region. The width of the destination region is the same as the width of the source rect.</param>
 /// <param name="dstY">The Y coordinate of the top-most edge of the destination region. The height of the destination region is the same as the height of the source rect.</param>
 /// <param name="srcResource">Source resource. Must be multisampled or compressed.</param>
 /// <param name="srcSubresource">A zero-based index that identifies the source subresource.</param>
 /// <param name="format">A <see cref="Format"/> that specifies how the source and destination resource formats are consolidated.</param>
 /// <param name="resolveMode">Specifies the operation used to resolve the source samples.</param>
 public void ResolveSubresourceRegion(
     ID3D12Resource dstResource,
     int dstSubresource,
     int dstX, int dstY,
     ID3D12Resource srcResource,
     int srcSubresource,
     Format format,
     ResolveMode resolveMode = ResolveMode.Decompress)
 {
     ResolveSubresourceRegion_(
         dstResource, dstSubresource, dstX, dstY,
         srcResource, srcSubresource, null,
         format, resolveMode);
 }
コード例 #8
0
        public unsafe void ResourceBarrierTransition(
            ID3D12Resource resource,
            ResourceStates stateBefore,
            ResourceStates stateAfter,
            int subresource            = -1,
            ResourceBarrierFlags flags = ResourceBarrierFlags.None)
        {
            var barrier = new ResourceBarrier
            {
                Type       = ResourceBarrierType.Transition,
                Flags      = flags,
                Transition = new ResourceTransitionBarrier(resource, stateBefore, stateAfter, subresource)
            };

            ResourceBarrier(1, new IntPtr(&barrier));
        }
コード例 #9
0
 public void UpdateTileMappings(
     ID3D12Resource resource,
     TiledResourceCoordinate[] resourceRegionStartCoordinates,
     TileRegionSize[] resourceRegionSizes,
     ID3D12Heap heap,
     TileRangeFlags[] rangeFlags,
     int[] heapRangeStartOffsets,
     int[] rangeTileCounts,
     TileMappingFlags flags = TileMappingFlags.None)
 {
     UpdateTileMappings(resource,
                        resourceRegionStartCoordinates.Length,
                        resourceRegionStartCoordinates,
                        resourceRegionSizes,
                        heap,
                        rangeFlags.Length,
                        rangeFlags,
                        heapRangeStartOffsets,
                        rangeTileCounts,
                        flags);
 }
コード例 #10
0
 public int CalcSubresource(int mipSlice, int arraySlice, int planeSlice)
 {
     return(ID3D12Resource.CalculateSubresource(mipSlice, arraySlice, planeSlice, MipLevels, ArraySize));
 }
コード例 #11
0
        public void ResourceBarrierUnorderedAccessView(ID3D12Resource resource)
        {
            var barrier = new ResourceBarrier(new ResourceUnorderedAccessViewBarrier(resource));

            ResourceBarrier(1, &barrier);
        }
コード例 #12
0
        public void ResourceBarrierAliasing(ID3D12Resource resourceBefore, ID3D12Resource resourceAfter)
        {
            var barrier = new ResourceBarrier(new ResourceAliasingBarrier(resourceBefore, resourceAfter));

            ResourceBarrier(1, &barrier);
        }
コード例 #13
0
        public unsafe void ResourceBarrierUnorderedAccessView(ID3D12Resource resource)
        {
            var barrier = new ResourceBarrier(new ResourceUnorderedAccessViewBarrier(resource));

            ResourceBarrier(1, new IntPtr(&barrier));
        }
コード例 #14
0
 /// <summary>
 /// Create a new UAV resource barrier instance.
 /// </summary>
 /// <param name="resource">The resource.</param>
 /// <returns>New intance of <see cref="ResourceBarrier"/> struct.</returns>
 public static ResourceBarrier BarrierUnorderedAccessView(ID3D12Resource resource)
 {
     return(new ResourceBarrier(new ResourceUnorderedAccessViewBarrier(resource)));
 }
コード例 #15
0
 /// <summary>
 /// Create a new aliasing resource barrier.
 /// </summary>
 /// <param name="resourceBefore">The resource before.</param>
 /// <param name="resourceAfter">The resource after.</param>
 /// <returns>New intance of <see cref="ResourceBarrier"/> struct.</returns>
 public static ResourceBarrier BarrierAliasing(ID3D12Resource resourceBefore, ID3D12Resource resourceAfter)
 {
     return(new ResourceBarrier(new ResourceAliasingBarrier(resourceBefore, resourceAfter)));
 }
コード例 #16
0
 /// <summary>
 /// Create a new transition resource barrier.
 /// </summary>
 /// <param name="resource">The transition resource.</param>
 /// <param name="stateBefore">The state before.</param>
 /// <param name="stateAfter">The state after.</param>
 /// <param name="subresource">The subresource.</param>
 /// <param name="flags">The transition flags.</param>
 /// <returns>New intance of <see cref="ResourceBarrier"/> struct.</returns>
 public static ResourceBarrier BarrierTransition(ID3D12Resource resource, ResourceStates stateBefore, ResourceStates stateAfter,
                                                 int subresource = D3D12.ResourceBarrierAllSubResources, ResourceBarrierFlags flags = ResourceBarrierFlags.None)
 {
     return(new ResourceBarrier(new ResourceTransitionBarrier(resource, stateBefore, stateAfter, subresource), flags));
 }