예제 #1
0
        public static ulong UpdateSubresources(
            ID3D12GraphicsCommandList pCmdList,
            ID3D12Resource pDestinationResource,
            ID3D12Resource pIntermediate,
            ulong IntermediateOffset,
            int FirstSubresource,
            int NumSubresources,
            Span <SubresourceData> pSrcData)
        {
            Span <PlacedSubresourceFootPrint> pLayouts = stackalloc PlacedSubresourceFootPrint[NumSubresources];
            Span <ulong> pRowSizesInBytes = stackalloc ulong[NumSubresources];
            Span <int>   pNumRows         = stackalloc int[NumSubresources];

            var          Desc    = pDestinationResource.Description;
            ID3D12Device pDevice = null;

            pDestinationResource.GetDevice(out pDevice);
            pDevice.GetCopyableFootprints(Desc, (int)FirstSubresource, (int)NumSubresources, IntermediateOffset, pLayouts, pNumRows, pRowSizesInBytes, out ulong RequiredSize);
            pDevice.Release();

            ulong Result = UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, pLayouts, pNumRows, pRowSizesInBytes, pSrcData);

            return(Result);
        }