/// <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;
        }
Пример #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)
        {
            Guard.NotNull(resource, nameof(resource));

            ResourcePointer = resource.NativePointer;
            Subresource     = subresource;
            StateBefore     = stateBefore;
            StateAfter      = stateAfter;
            Subresource     = subresource;
        }
        public unsafe void ResourceBarrierUnorderedAccessView(ID3D12Resource resource)
        {
            var barrier = new ResourceBarrier
            {
                Type = ResourceBarrierType.UnorderedAccessView,
                UnorderedAccessView = new ResourceUnorderedAccessViewBarrier(resource)
            };

            ResourceBarrier(1, new IntPtr(&barrier));
        }
        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));
        }
 public unsafe void ClearUnorderedAccessView(
     GpuDescriptorHandle viewGpuHandleInCurrentHeap,
     CpuDescriptorHandle viewCpuHandle,
     ID3D12Resource resource,
     IntVector4 clearValue,
     params RectI[] rectangles)
 {
     if (rectangles.Length == 0)
     {
         ClearUnorderedAccessViewUint(viewGpuHandleInCurrentHeap, viewCpuHandle, resource, clearValue, 0, null);
     }
     else
     {
         ClearUnorderedAccessViewUint(viewGpuHandleInCurrentHeap, viewCpuHandle, resource, clearValue, rectangles.Length, rectangles);
     }
 }
        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));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ResourceUnorderedAccessViewBarrier"/> struct.
        /// </summary>
        /// <param name="resource">The resource.</param>
        /// <exception cref="System.ArgumentNullException">resourceBefore</exception>
        public ResourceUnorderedAccessViewBarrier(ID3D12Resource resource)
        {
            Guard.NotNull(resource, nameof(resource));

            ResourcePointer = resource.NativePointer;
        }